What are the differences between HashMap and HashTable in Java?

1 Answers

Mukul Goenka
Mukul Goenka


HashMap  HashTable
HashMap is not synchronized thereby making it better for non-threaded applications. HashTable is synchronized and hence it is suitable for threaded applications.
Allows only one null key but any number of null in the values. This does not allow null in both keys or values.
Supports order of insertion by making use of its subclass LinkedHashMap. Order of insertion is not guaranteed in HashTable.


Answer