This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Vector Vs. LinkList Vs. ArrayList Vs. Collection Vs. HashTable

 
Angela D'souza
Ranch Hand
Posts: 469
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what are difference between Vector Vs. LinkList Vs. ArrayList Vs. Collection Vs. HashTable.
Thanks,
Angela
 
Gerry Giese
Ranch Hand
Posts: 247
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
David Duran
Ranch Hand
Posts: 122
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic