If we can make ArrayList synchronized then, what is the need for Vector?

advertisements

if we can make ArrayList synchronized then what is the need of Vector? similarly, if we can make HashMap synchronized then what is the need of Hashtable?


The reasons why both Vector and ArrayList exist is historical: the Vector class was there in the Java 1, while ArrayLists were added in Java 1.2 as a "lighter-weight" alternative. Java keeps Vector for backward compatibility; it should not be used unless you want a synchronized version of an ArrayList.