20 May 2013

Difference between array list and hash table


Array List:

1.Array List is a List 
2.In this we can only add items to the list 
3.Here we Can Add any datatype value,Every item in arraylist is treated as object 
4. ArrayList Key must be numeric.
5. Arraylist is a collection of objects(may be of different types).

Hash Table:

1.Hash Table is a map 
2.Here we can add data with the key 
3.Retrieving by key in Hashtable is faster than retrieving in Arraylist.
4. Hashtable Contain two parameter first is Key and other is Value and in case of Hash Table key may be numeric or Alpha.
5. Hashtable is also collection which takes a key corresponding to each values.

No comments:

Post a Comment