This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes order in a collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "order in a collection" Watch "order in a collection" New topic
Author

order in a collection

Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
I am looking for a Collection that guarentees that the order in which I place objects will be maintained. Does anyone have any suggestions?


Matthew Phillips
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
Nevermind. It looks like an ArrayList will fit my needs perfectly.
Roy Ben Ami
Ranch Hand

Joined: Jan 13, 2002
Posts: 732
all collections that use the List interace accomplish just that. ArrayList is the best one in my opinon too although LinkedList does the same.
Matthew Phillips
Ranch Hand

Joined: Mar 09, 2001
Posts: 2676
Originally posted by Roy Ben Ami:
all collections that use the List interace accomplish just that. ArrayList is the best one in my opinon too although LinkedList does the same.

Right. I decided on the ArrayList because I am not going to be inserting objects in the beginning or deleting objects from an iterator. It has been awhile since I have worked with any of the Collections so I couldn't remember which interface featured guaranteed order.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: order in a collection
 
Similar Threads
About Hashtable
Regarding Collections
Representing collections in UML
Which collection class would you use to store the objects?
sorting a TreeMap