There are following difference between ArrayList and Hashtable :
Array List
|
Hash Table
|
Array List is one type of generic List
|
Hash Table is a map.
|
In Array list we can only add items to the list.
|
In Hashtable we can add data with the key.
|
we Can Add any datatype value, Every item in Arraylist is as object.
|
Retrieving by key in Hashtable is faster than retrieving in
Arraylist.
|
Index only in Numeric.
|
Index can be string also.
|
Data in Arraylist is stored in as only the value.
|
Data in Hashtable is stored in the key-value pair.
|
Slow when come to search
|
Fast when searching.
|
It is store only value.
|
It is store data as name, value pair
|
If you want to access value from Arraylist, you need to pass index.
|
If you want to access value from Hashtable, you need to pass name.
|
Arraylist you can store only similar type of data.
|
In a Hashtable you can store different type of data like int, string
etc
|
No comments:
Post a Comment