List of usage examples for java.util Vector add
public synchronized boolean add(E e)
From source file:Main.java
public static void main(String[] args) { Vector vec = new Vector(4); vec.add(4); vec.add(3);//w w w. j av a 2s . c om 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<String> v = new Vector<String>(); v.add("1"); v.add("2");//from w w w. ja va 2 s . co m v.add("3"); v.add("4"); v.add("5"); v.add("1"); v.add("2"); System.out.println(v.indexOf("1", 4)); System.out.println(v.lastIndexOf("2", 5)); }
From source file:Main.java
public static void main(String args[]) { Vector<String> v1 = new Vector<String>(); v1.add("A"); v1.add("B");/*from w w w. j a v a2 s .c o m*/ v1.add("C"); List l = v1.subList(1, 2); l.remove(0); System.out.println(l); System.out.println(v1); }
From source file:Main.java
public static void main(String[] args) { Vector vec = new Vector(4); vec.add(4); vec.add(3);//from w w w . j a va 2 s . c om 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<String> v = new Vector<String>(); v.add("A"); v.add("B");/*from w ww.java 2s.com*/ v.add("A"); v.add("C"); v.add("D"); System.out.println(v); Collections.replaceAll(v, "A", "Replace All"); System.out.println(v); }
From source file:Main.java
public static void main(String[] args) { Vector<String> v = new Vector<String>(); v.add("1"); v.add("2");// w w w . j ava2 s . c o m v.add("3"); v.add("4"); v.add("5"); System.out.println(v); Collections.swap(v, 0, 4); 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); vec.add(3);//from w ww . jav a 2 s . c o m vec.add(2); vec.add(1); System.out.println(vec.elementAt(1)); }
From source file:Main.java
public static void main(String[] args) { Vector<String> v = new Vector<String>(); v.add("A"); v.add("B");/* w w w.j a v a2s . co m*/ v.add("D"); System.out.println(v); Collections.fill(v, "REPLACED"); System.out.println(v); }
From source file:Main.java
public static void main(String[] args) { Vector<Integer> vec = new Vector<Integer>(); vec.add(4); vec.add(3);//from ww w . j a va 2 s.c om vec.add(2); vec.add(1); System.out.println(vec); }
From source file:Main.java
public static void main(String[] args) { Vector<String> v = new Vector<String>(); v.add("1"); v.add("2");//w ww . java 2 s . c om v.add("3"); v.add("4"); v.add("5"); v.add("1"); v.add("2"); System.out.println(v.contains("3")); System.out.println(v.indexOf("5")); System.out.println(v.lastIndexOf("2")); }