List of usage examples for java.util Vector Vector
public Vector(Collection<? extends E> c)
From source file:Main.java
public static void main(String args[]) { Vector<Object> v = new Vector<Object>(5); for (int i = 0; i < 10; i++) { v.add(0, i);// w ww. j a v a2 s. c o m } System.out.println(v); for (int i = 0; i < 10; i++) { v.set(i, "A"); } System.out.println(v); }
From source file:Main.java
public static void main(String[] args) { Vector<Integer> vec = new Vector<Integer>(4); vec.add(4);// w ww . j a va2 s .c o m vec.add(3); vec.add(2); vec.add(1); System.out.println(vec.elementAt(1)); }
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. j ava2 s . c o m*/ } System.out.println(v); System.out.println(v.size()); for (int i = 0; i < 10; i++) { v.add(0, i); } System.out.println(v); System.out.println(v.size()); }
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 2s. c om vec.add(3); vec.add(2); vec.add(1); System.out.println(vec); // let us insert element at 1st position vec.insertElementAt(133, 1); System.out.println(vec); }
From source file:Main.java
public static void main(String[] args) { Vector vec = new Vector(4); vec.add(4);//from w w w . ja v a 2 s .co m vec.add(3); vec.add(2); vec.add(3); vec.add(2); vec.add(3); /** let us get the index of 3 * starting search from 2nd index */ System.out.println("Index of 3 :" + vec.indexOf(3, 2)); }
From source file:Main.java
public static void main(String[] args) { Vector<Integer> vec = new Vector<Integer>(4); vec.add(4);/* w ww.j a v a2 s. c om*/ vec.add(3); vec.add(2); vec.add(1); System.out.println(vec); }
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. j a va2 s . co m } System.out.println(v); Vector v2 = new Vector(5); for (int i = 0; i < 10; i++) { v2.add(0, i); } System.out.println(v2); System.out.println(v2.equals(v)); }
From source file:Main.java
public static void main(String[] args) { Vector<Integer> vec = new Vector<Integer>(4); vec.add(4);/* w w w . ja va2 s . c om*/ vec.add(3); vec.add(2); vec.add(1); // let us check the first element of the vector System.out.println("First element is :" + vec.firstElement()); }
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.ja v a2s.c om vec.add(3); vec.add(2); vec.add(1); // let us check the existence of number 4 in the vector System.out.println(vec.contains(4)); }
From source file:Main.java
public static void main(String[] args) { Vector vec = new Vector(4); vec.add(4);/*from w w w . ja v a 2s.c om*/ vec.add(3); vec.add(2); vec.add(1); System.out.println(vec); System.out.println("Size of the vector: " + vec.size()); // let us remove all the elements System.out.println("Removing all the elements"); vec.removeAll(vec); System.out.println("Size of the vector: " + vec.size()); }