This is not a question about the differences between I understand that a Hashtable and HashMap.Hashtable object cannot accept null values for either key or value entries, that it is synchronized collection, and that it uses slightly less memory than a HashMap.
I’m wondering about the scenarios where it would be more appropriate to use a Hashtable instead of a HashMap.
Well it is really…
Precisely when you want the differences between the two:
Collections.synchronizedMapover aHashMapHashtable(relatively rare, fortunately)I can’t remember the last time I was in that situation, personally – I would say it’s vanishingly rare to be appropriate to use
Hashtablein modern Java code.