I met during the interview, but I won't. I came back to Google to share it with me. It is said to be a problem of old teeth.
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 key values ), because of non-thread security, the efficiency may be higher than that of hashtable.
Hashmap allows null as the key or value of an entry, whereas hashtable does not.
Hashmap removes the contains method of hashtable and changes it to containsvalue and containskey. The contains method is easy to misunderstand.
Hashtable inherits from the dictionary class, while hashmap is an implementation of the map interface introduced by java1.2.
The biggest difference is that the hashtable method is synchronize, but hashmap is not. It is accessed in multiple threads.
In hashtable, you do not need to implement synchronization for its own method, but hashmap must provide external synchronization for it.
Hash/rehash used by hashtable and hashmapAlgorithmSo the performance will not be significantly different.