1.

Differentiate between HashMap and HashTable.

Answer»

FOLLOWING are the differences between HashMap and HashTable:

  • HashMap is a non-synchronized DATA structure. It is not thread-safe and cannot be SHARED across many THREADS without the use of synchronization code, while Hashtable is synchronized. It's thread-safe and can be used by several threads.
  • HashMap supports one null key and numerous null values, whereas Hashtable does not.
  • If thread synchronization is not required, HashMap is often PREFERABLE over HashTable.


Discussion

No Comment Found