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
.
This is not a question about the differences between
Hashtable
andHashMap
Well it is really...
I'm wondering about the scenarios where it would be more appropriate to use a
Hashtable
instead of aHashMap
.
Precisely when you want the differences between the two:
Collections.synchronizedMap
over a HashMap
Hashtable
(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 Hashtable
in modern Java code.