What is the difference between Hash table and Array list?
Asked 8 years ago720 views
1
What is the difference between Hash table and Array list?
1 Answer
0
"Difference between HashTable and Array List"
HashTable
Hash Table is a collection of an object in Key and Value pair. And each object in the Hash Table is stored in a Key and Value format.
In Hashtable, searching operation is much faster than the array list.
For accessing of value in a hash table, you just need to pass key name.
It can store different types of data like int, char, String, Boolean etc.
In a hash table, the size of an element is not defined.
It stores a unique key object, in case of hash table key can’t be duplicate.
It is easily synchronized. And Hashtable is similar to HashMap which can store the value in key-value format.
Array List
Array List is the homogeneous collection of an element. And it can store each element in a particular index.
In Array list, searching of the element is so difficult in comparison to the hash table.
For accessing of value in an array list, you need to pass index number.
It can store only similar types of element.
It is created with initial (fixed length) size.
It can store duplicate and dissimilar types of element.
It is not easily synchronized.
Write Your Answer
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.