List of usage examples for java.util Vector add
public synchronized boolean add(E e)
From source file:MainClass.java
public static void main(String args[]) { Vector<String> v = new Vector<String>(); v.add("A"); v.add("B");/*ww w.j av a2 s .c om*/ Enumeration e = v.elements(); while (e.hasMoreElements()) { System.out.println(e.nextElement()); } }
From source file:Sequence.java
public static void main(String args[]) throws IOException { Vector v = new Vector(3); v.add(new FileInputStream("/etc/motd")); v.add(new FileInputStream("foo.bar")); v.add(new FileInputStream("/temp/john.txt")); Enumeration e = v.elements(); SequenceInputStream sis = new SequenceInputStream(e); InputStreamReader isr = new InputStreamReader(sis); BufferedReader br = new BufferedReader(isr); String line;/*from ww w . j ava 2 s . c om*/ while ((line = br.readLine()) != null) { System.out.println(line); } br.close(); }
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 av a 2 s . c o m*/ Iterator i = v.iterator(); while (i.hasNext()) { System.out.println(i.next()); } }
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 ava2 s . com*/ 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()); }
From source file:MainClass.java
public static void main(String args[]) throws Exception { Vector v = new Vector(3); v.add(new FileInputStream("/a/b")); v.add(new FileInputStream("yourfile.bar")); v.add(new FileInputStream("/yourfile.txt")); Enumeration e = v.elements(); SequenceInputStream sis = new SequenceInputStream(e); InputStreamReader isr = new InputStreamReader(sis); BufferedReader br = new BufferedReader(isr); String line;//w w w . ja v a2s.c o m while ((line = br.readLine()) != null) { System.out.println(line); } br.close(); }
From source file:Main.java
public static void main(String args[]) { Vector<String> v1 = new Vector<String>(); v1.add("A"); v1.add("B");// ww w . ja va 2 s . c om v1.add("C"); Object[] array = v1.toArray(); for (int i = 0; i < array.length; i++) { System.out.println(array[i]); } }
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 av a2 s. c o m*/ v1.add("C"); List l = v1.subList(1, 2); for (int i = 0; i < l.size(); i++) { System.out.println(l.get(i)); } }
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 a va2s .com v.add("3"); v.set(1, "REPLACED ELEMENT"); for (String str : v) { System.out.println(str); } }
From source file:Main.java
public static void main(String args[]) { Vector<String> v1 = new Vector<String>(); v1.add("A"); v1.add("B");// www . ja v a2 s. c om v1.add("C"); String array[] = new String[v1.size()]; v1.copyInto(array); for (int i = 0; i < array.length; i++) { System.out.println(array[i]); } }
From source file:Main.java
public static void main(String args[]) { Vector<String> v1 = new Vector<String>(); v1.add("A"); v1.add("B");/*from www . ja v a 2s .c om*/ v1.add("C"); String array[] = new String[0]; array = (String[]) v1.toArray(array); for (int i = 0; i < array.length; i++) { System.out.println(array[i]); } }