What's the difference between a hashtable and a hashmap?
Anonymous
I'd assume this question is asked in Java context. There are 3 differences: 1. Hashtable is completely synchronized. There is no concurrent access allowed but it is thread-safe in the sense that only a single thread can access the table. HashMap is not thread-safe in any ways. 2. Hashtable does not allow null keys or null values(you will get a NPE). HashMap allows both null keys and values. 3. Hashtable's enumerator is not fail safe, meaning if the map is changed during iteration, there is no way of knowing so. HashMap's iterator is fail safe, if the map is modified during iteration, you will get a ConcurrentModificationException.
Check out your Company Bowl for anonymous work chats.