两者的区别:HashTable 是所有的方法都加锁。
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.