aspose file tools*
The moose likes Java in General and the fly likes Vector Vs. LinkList Vs. ArrayList Vs. Collection Vs. HashTable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Vector Vs. LinkList Vs. ArrayList Vs. Collection Vs. HashTable" Watch "Vector Vs. LinkList Vs. ArrayList Vs. Collection Vs. HashTable" New topic
Author

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

Angela D'souza
Ranch Hand

Joined: Jan 16, 2002
Posts: 469
what are difference between Vector Vs. LinkList Vs. ArrayList Vs. Collection Vs. HashTable.
Thanks,
Angela
Gerry Giese
Ranch Hand

Joined: Aug 02, 2001
Posts: 247
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)
Author of Posts in the Saloon
David Duran
Ranch Hand

Joined: Feb 11, 2002
Posts: 122
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

Joined: Mar 22, 2002
Posts: 1055
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

Joined: Jan 30, 2000
Posts: 18671
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
Anthony Villanueva
Ranch Hand

Joined: Mar 22, 2002
Posts: 1055
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Vector Vs. LinkList Vs. ArrayList Vs. Collection Vs. HashTable