This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
The specifics are all layed out for you in the java.util.* JavaDocs for the J2SE API at java.sun.com. I will give you a hint to start with - Collection is the interface at the top of a hierarchy, and the others are implementations. There are lots of other collectiosn out there. It is more than worthwhile to look into them all by browsing the JavaDocs. Always go to the JavaDoc first, then go look for extra info using google or a reference book. A good one online is "Thinking In Java", 2nd Edition by Bruce Eckel.
CJP (Certifiable Java Programmer), AMSE (Anti-Microsoft Software Engineer)<br />Author of <a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi" target="_blank" rel="nofollow">Posts in the Saloon</a>
I too was confused about those types of data structures and I found this nice tutorial on java.sun. I haven't gone through the entire thing but the Introduction and Interfaces sections were most useful if you don't have that much time. http://java.sun.com/docs/books/tutorial/collections/
Hi, A Collection is an interface. A List is an interface which extends Collection. It may contain duplicate elements. Vector, LinkedList and ArrayList are all implementations of List. A Vector and an ArrayList are basically the same, except access to a Vector's elements are synchronized, with corresponding performance penalties. They are also both dynamically resizable. A LinkedList is not dynamically resizable. For for more on Collections, you might want to try this link A Hashtable is an implementation of a Map. A Map is an interface like Collection, except it has key-value pairs. A Hashtable has synchronized access to its elements, like a Vector. -anthony [ March 29, 2002: Message edited by: Anthony Villanueva ]
A LinkedList is not dynamically resizable. ??? Sure it is. Any List grows as necessary whenever elements are added to it. Not sure where this idea came from.
"I'm not back." - Bill Harding, Twister
Joined: Mar 22, 2002
Hi, Sorry, I meant to say: dynamically resizable array . I hope nobody took that seriously. A LinkedList has a different implementation than the other two, so positional access differs in performance. -anthony