Re: What is the diffrence between Array,Vector,ArryList,LinkedList and HashTable with HashMap with example and situation?
Posted By:
atul_gupta
Posted On:
Tuesday, December 23, 2003 01:22 AM
Array: Constant sized,Not synchronized
Vector:variable sized,Synchronized
LinkedList:variable sized,preferred when calling addFirst,addLast,removeLast,removefirst.However, arraylist
are preferred over LinkedList in terms of performance
ArrayList:variable sized,Not synchronized
Hashtable: Synchronized
HashMap:Not synchronized,Holds null values
Re: What is the diffrence between Array,Vector,ArryList,LinkedList and HashTable with HashMap with example and situation?
Posted By:
Mike_John
Posted On:
Tuesday, December 23, 2003 01:13 AM
Once u create an array (of any type) u can't change the array size at dynamically. U can view a Vector as a dynamic array. U can resize the vector at runtime. u can add/remove element in a vector at runtime.
An ArrayList is a class which implements the List interface. This again is resizable and u hav all the functionalities of a list. Note : u can hav duplicates in ArrayList.
A LinkedList is an implementation of the calssical 'C' linked list. U can get, remove or insert elements.
HashTable is basically a key-value pair collection. Key has to be unique. U can do get and put.
HashMap is implementation of Map interface. U can hav null key or null value. Use when u require constant time performance.