Collections Java Tutorial

Creating Vectors

public Vector()
public Vector(int initialCapacity)
public Vector(int initialCapacity, int capacityIncrement)
The reason for the different constructors is basically performance.

import java.util.Vector;
public class MainClass {
  public static void main(String args[]) {
    Vector v = new Vector(5);
    for (int i = 0; i < 10; i++) {
      v.add(i);
    }
    System.out.println(v);
  }
}
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]