Difference between HashMap and Hashtable

HashMapHashtable
Every method in HashMap is not synchronizedEvery method in Hashtable is Synchronized
No thread SafeThread Safe
Relatively performance is highRelatively performance is low
Null key and Null values allowed in HashMapNull key and Null value not allowed in Hashtable
Not legacy class, introduced in java 1.2Legacy class, introduced in java 1.0
We can get synchronized version of HashMap by passing it to Collection.synchronizedMap() methodNo such functionality to disable chronization is available here.

Leave a Comment