File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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