HashMap is a lightweight implementation of Hashtable (non-thread-safe implementation). They all complete the Map interface. The main difference is that HashMap allows null keys. Due to non-thread-safe, it may be more efficient than Hashtable.
HashMap allows null as a key or value of an entry, while Hashtable does not.
HashMap removes the Hashtable contains method and changes it to containsvalue and containsKey. Because the contains method is easy to cause misunderstanding.
Hashtable inherits from the Dictionary class, and HashMap is an implementation of Map interface introduced by Java 1.2.
The biggest difference is that the Hashtable method is Synchronize, while HashMap is not. When multiple threads access Hashtable, they do not need to implement synchronization for its methods themselves, and HashMap must provide external synchronization for it.
The hash/rehash algorithms used by Hashtable and HashMap are roughly the same, so there will be no big difference in performance.