Because Vector
and Hashtable
are old, legacy collection classes. Don't use them.
Instead of Vector
use ArrayList
; instead of Hashtable
use HashMap
.
When Java 1.2 was released (very long ago), new collection classes were added to Java (the Collections Framework). Sun did not remove the old classes such as Vector
and Hashtable
because they wanted the new Java version to be backwards compatible. And now we still have those old classes.
One difference to be aware of is that Vector
and Hashtable
are synchronized, while ArrayList
and HashMap
are not. Most of the time you don't need synchronization; if you do, then you must take care to synchronize your ArrayList
, and if you need a map, use ConcurrentHashMap
instead of plain HashMap
.