List of usage examples for java.util Vector Vector
public Vector(Collection<? extends E> c)
From source file:MainClass.java
public static void main(String args[]) { Vector v = new Vector(5); for (int i = 0; i < 10; i++) { v.add(0, i);//from www.jav a2 s . co m } System.out.println(v); System.out.println(v.size()); v.ensureCapacity(40); for (int i = 0; i < 10; i++) { v.add(0, i); } System.out.println(v); System.out.println(v.size()); }
From source file:MainClass.java
public static void main(String args[]) { Vector v = new Vector(5); for (int i = 0; i < 10; i++) { v.add(0, i);/*w w w . ja va 2s. c om*/ } System.out.println(v); Vector v2 = new Vector(5); for (int i = 0; i < 5; i++) { v2.add(0, i); } System.out.println(v2); System.out.println(v2.equals(v)); v.retainAll(v2); System.out.println(v); }
From source file:Main.java
public static void main(String[] args) { Vector vec = new Vector(4); vec.add(4);/*from w w w .j ava2 s .co m*/ vec.add(3); vec.add(2); vec.add(1); System.out.println(vec); System.out.println("Size of the vector: " + vec.size()); System.out.println("Removing all elements"); // lets remove all the elements vec.removeAllElements(); System.out.println("Now size of the vector: " + vec.size()); }
From source file:Main.java
public static void main(String[] args) { Vector<Integer> vec = new Vector<Integer>(4); vec.add(4);//from www . j a v a 2 s . com vec.add(3); vec.add(2); vec.add(1); // set new size to 8 vec.setSize(8); for (Integer number : vec) { System.out.println("Number = " + number); } }
From source file:Main.java
public static void main(String[] args) { Vector vec = new Vector(4); vec.add(4);//from w w w. j a va 2 s. c o m vec.add(3); vec.add(2); vec.add(1); System.out.println(vec); System.out.println("Size of the vector: " + vec.size()); System.out.println("Removing all elements"); // lets remove all the elements vec.removeElement(3); System.out.println("Now size of the vector: " + vec.size()); }
From source file:Main.java
public static void main(String[] args) { Vector<Integer> vec = new Vector<Integer>(4); vec.add(4);//from ww w .j av a 2 s. c om vec.add(3); vec.add(2); vec.add(1); vec.setElementAt(11, 2); for (Integer number : vec) { System.out.println("Number = " + number); } }
From source file:Main.java
public static void main(String[] args) { Vector<Integer> vec = new Vector<Integer>(4); vec.add(4);/* www . ja v a2 s .c o m*/ vec.add(3); vec.add(2); vec.add(1); System.out.println(vec); // add new element vec.addElement(12); System.out.println(vec); }
From source file:Main.java
public static void main(String[] args) { Vector<Integer> vec = new Vector<Integer>(4); vec.add(4);/*from w ww . j a va 2 s . c o m*/ vec.add(3); vec.add(2); vec.add(1); // set 15 at 2nd index position vec.set(2, 15); for (Integer number : vec) { System.out.println("Number = " + number); } }
From source file:Main.java
public static void main(String[] args) { Vector<Integer> vec = new Vector<Integer>(4); vec.add(4);//from w w w. j ava 2 s . c o m vec.add(3); vec.add(2); vec.add(1); // lets remove element at index 2 System.out.println("Remove element at index 2"); vec.removeElementAt(2); for (Integer number : vec) { System.out.println("Number = " + number); } }
From source file:Main.java
public static void main(String args[]) { Vector<Integer> v = new Vector<Integer>(5); for (int i = 0; i < 10; i++) { v.add(0, i);//from www . j a va2 s . co m } System.out.println(v); Vector<Integer> v2 = new Vector<Integer>(5); for (int i = 0; i < 10; i++) { v2.add(0, i); } System.out.println(v2); System.out.println(v2.equals(v)); v2.removeAll(v); System.out.println(v2); }