Java Vector Overview: Dynamic Array, Synchronized, Legacy Class

Week 3 - Day 16 : Vector in java A vector in java is a part of the java.util.package and is one of the legacy classes in java that implements the list interface. Key features of an vector : 1) Dynamic Array : Like Arraylist, Vector is a Dynamic array that grows automatically when more elements, are added then the current capacity. 2) Synchronized : All the methods in vector are Synchronized, which make it thread safe .This means multiple thread can work on a vector without the risk of corrupting the data. 3) Legacy class : Vector was part of java original release and is considered legacy class. It's generally recommended to use Arraylist in single thread environments due to performance consideration. 4) Resizing mechanism : When the current capacity of the vector is exceeded, it doubles it's size by default. 5) Random Access : Similar to arrays and Arraylist, vector allows random access to elements, making it efficient for accessing elements using an index . #java #programming #javacore #vector #learning EchoBrains

  • diagram

To view or add a comment, sign in

Explore content categories