What is the difference between Hash table and Array list?

1 votes
125 views
Tarun Kumar asked 15-Nov-2017 in programming by Tarun Kumar

What is the difference between Hash table and Array list?

1 Answer

0 votes
Arti Mishra answered 06-Sep-2018 by Arti Mishra

"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.

    What is the difference between Hash table and Array list?


    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.

What is the difference between Hash table and Array list?