InterviewSolution
Saved Bookmarks
| 1. |
What is the difference between a HashTable and a HashMap? |
|
Answer» HASHTABLE and HashMap both store key-value pairs and take a constant time to put or GET operations. HOWEVER, Hashtable is SYNCHRONIZED and can be shared to get modified by multiple threads while HashMap is not synchronized and performs better, but not suitable for the multithreaded environment as a shared object. HashTable doesn’t allow NULL keys or values, bur a HashMap allows a Null key and more than one Null values. |
|