HashMap | Hashtable |
---|---|
HashMap lets you have null values as well as one null key. | HashTable does not allows null values as key and value. |
The iterator in the HashMap is fail-safe (If you change the map while iterating, you’ll know). | The enumerator for the Hashtable is not fail-safe. |
HashMap is unsynchronized. | Hashtable is synchronized. |
Note: Only one NULL is allowed as a key in HashMap. HashMap does not allow multiple keys to be NULL. Nevertheless, it can have multiple NULL values.
No comments:
Post a Comment