aspose file tools*
The moose likes Java in General and the fly likes java collections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java collections" Watch "java collections" New topic
Author

java collections

Mario A. Villamizar
Ranch Hand

Joined: Mar 14, 2002
Posts: 35
hi,
I'm building an application where I need a collection to hold some objects of the same class. it can grows or decrease in size implementing insertions and deletions respectibly. duplicates are not allow.
I think I could use a set but I not sure how to use it, can you show me an example, or tellme which collection is it much better for the application.
As well I heard that the vector class was deprecated in j2se 1.4, is that true?
many thanks,


MA Villamizar
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I made a little crib sheet to help me remember which collection to use. See if the qualities listed match up with what you need to do and help you pick one. There is a tiny example of creating and filling a HashMap there, too. Hope that helps!


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Charles Hasegawa
Ranch Hand

Joined: May 22, 2003
Posts: 117
Use a LinkedHashSet. If the objects that will be held are custom objects, make sure that the .equals and .hashCode methods are implemented correctly.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java collections