HashMap vs HashTable

Hashmap vs Hashtable 1. HashMap is non synchronized. It is not-thread safe and can’t be shared between many threads without proper synchronization code whereas Hashtable is synchronized. It is thread-safe and can be shared with many threads. 2. HashMap allows one null key and multiple null values whereas Hashtable doesn’t allow any null key or value. 3. HashMap is generally preferred over HashTable if thread synchronization is not needed

Last updated