This is not a question about the differences between I understand that a Hashtable
and HashMap
.Hashtable
object cannot accept
Never.
Hashtable was the original implementation of a map in Java 1. It's been overtaken by the MapHashtable
has been retrofitted to implement Map
but that's not terribly useful.
It has the main problem in that it's synchronized. This means that it will be slow in any circumstance where it is shared between threads. ConcurrentHashMap is a better choice in that situation. If you are running on a single thread then the un-synchronized HashMap is a better choice.