Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

The different ways of storing obj.'s

Status
Not open for further replies.

scott87

Programmer
Jun 1, 2001
1
US
I have been looking over the Java util package, and I am having problems deciding which object to use to store objects in a dynamic manner. I was thinking about Vector, LinkedList, List, or one of the Hash objects. Could someone briefly describe the differences between these? Specificly, if I just want a dynamic list of objects, which is the smallest or quickest? I don't need much extra stuff, just the ability to add and remove specific entries.
 

hi,

you can use an HashMap object

it should be enough for your needs

HashMap hm = new HashMap();
hm.put("hello",onject);
hm.remove("hello");

Vector is a dynamic array, you can access elements with an index variable.

LinkedList allows to do FIFO (fist in first out) and LIFO (last in first out = a Stack object), you can add elements at beginning at end and iterate through the list...

manu0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top