What are the differences between a HashMap and a Hashtable in Java?
Which is more efficient for non-threaded applications?
My small contribution :
First and most significant different between
Hashtable
andHashMap
is that,HashMap
is not thread-safe whileHashtable
is a thread-safe collection.Second important difference between
Hashtable
andHashMap
is performance, sinceHashMap
is not synchronized it perform better thanHashtable
.Third difference on
Hashtable
vsHashMap
is thatHashtable
is obsolete class and you should be usingConcurrentHashMap
in place ofHashtable
in Java.