This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
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 Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java collections" Watch "java collections" New topic

java collections

Mario A. Villamizar
Ranch Hand

Joined: Mar 14, 2002
Posts: 35
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.
subject: java collections
Similar Threads
regarding JTable
Need some help on Collections.
Using dependency injection for instantiating multiple implementations for an interface
Collection- Fast Retrieval
How to print a String with out duplicates