• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

I need a suitable data structure!

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to produce a JAVA top trumps game and need a data structure in which to store 'card' objects. It needs to be expandable (ruling out a conventional array) and I need to be able to shuffle the cards (ruling out a linked list). I have heard of a mythical array type that can be expanded and has a '.shuffle' method but can't find anything on it in my textbooks. If anyone can suggest a structure and give me a quick run-down on the syntax associated with it (or tell me where to look to find out about it) I would most grateful.
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll have to travel to far off lands and battle dragons to find it, but java.util.ArrayList is the magic you seek. Some have even read in ancient mystic scrolls of an incantation to shuffle any List.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic