What are the differences between a HashMap and a Hashtable in Java?
Which is more efficient for non-threaded applications?
Keep in mind that HashTable
was legacy class before Java Collections Framework (JCF) was introduced and was later retrofitted to implement the Map
interface. So was Vector
and Stack
.
Therefore, always stay away from them in new code since there always better alternative in the JCF as others had pointed out.
Here is the Java collection cheat sheet that you will find useful. Notice the gray block contains the legacy class HashTable,Vector and Stack.