When I tried to use the hashtable class, Netbeans gave me an error saying:
While still supported, these classes were made obsolete by the JDK1.2 collection classes, and should probably not be used in new development.
However, I can’t seem to find an example online on a better replacement for Hashtable. Any suggestions?
The most direct replacement of a
Hashtableis aHashMap.One difference that could be important is that all relevant methods of
Hashtableare synchronized while they are not synchronized onHashMap.