1Apr/110
Differences between HashMap and Hashtable
Fun facts about HashMap and Hashtable:
- Hashtable is thread-safe, HashMap isn't - that's something everybody knows;
- HashMap supports null keys and values - not so obvious, but very important;
- Enumerators returned from an Hashtable aren't fail-fast. Iterators from both classes are.
That was one of many questions I had to answer in a job interview. I admit I couldn't remember the second and third ones. I think I must study to upgrade my SCJP certification to refresh this kind of detail.