What is vector class in Java framework?
The Vector Class is dynamically grow-able and shrink-able collection of objects like an Array List class. There is a difference between ArrayList and Vector. The main difference between ArrayList and Vector is that Vector class is synchronized. Which means that, only one thread can enter into vector object at any moment of time.
Vector class is preferred first over ArrayList class when you are developing a multi threaded application. But, precautions should be taken because vector may reduce the performance of your application as it ensures thread safety and only one thread is allowed to have object lock at any moment of time and remaining threads have to wait until a thread releases the object lock which is held by it. So, it is always recommended that if you don’t need thread safety environment, it is better to use ArrayList class than the Vector class.
Vector class has same features as ArrayList. Vector class also extends AbstractList class and implements List interface. It also implements 3 marker interfaces – RandomAccess, Cloneable and Serializable.