Example usage for java.util Vector add

List of usage examples for java.util Vector add

Introduction

In this page you can find the example usage for java.util Vector add.

Prototype

public synchronized boolean add(E e) 

Source Link

Document

Appends the specified element to the end of this Vector.

Usage

From source file:MainClass.java

public static void main(String args[]) {
    Vector v = new Vector();
    v.add("Hello");
    String s = (String) v.get(0);
    System.out.println(s);//from   ww  w  .  j  ava 2  s  .  c  om
}

From source file:MainClass.java

public static void main(String args[]) {
    Vector v = new Vector();
    v.add("A");
    v.add("B");/*from w  ww . j a  v  a2  s  .  c o m*/

    int index = v.indexOf("B");

    System.out.println(index);
}

From source file:MainClass.java

public static void main(String args[]) {
    Vector v1 = new Vector();
    v1.add("A");
    v1.add("B");//from   w w  w . ja  v  a2 s  .c  o  m
    v1.add("C");
    Object[] array = v1.toArray();

    for (int i = 0; i < array.length; i++) {
        System.out.println(array[i]);
    }
}

From source file:MainClass.java

public static void main(String args[]) {
    Vector v = new Vector();
    v.add("A");
    v.add("B");//from  w w  w.  j  a va2s.  c  o m

    Vector outter = new Vector();
    outter.add(v);

    String s = (String) ((Vector) outter.get(0)).get(0);
    System.out.println(s);
}

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    Vector v = new Vector();
    v.add("a");
    v.add("b");//from  w w  w .j av  a 2  s .  c o m
    v.add("c");

    for (Enumeration e = v.elements(); e.hasMoreElements();) {
        Object o = e.nextElement();
        System.out.println(o);
    }
}

From source file:MainClass.java

public static void main(String args[]) {
    Vector v1 = new Vector();
    v1.add("A");
    v1.add("C");/* w  w w.  ja  v a2  s. c om*/
    v1.add("B");
    Vector v2 = (Vector) v1.clone();
    Collections.sort(v2);

    System.out.println(v1);
    System.out.println(v2);
}

From source file:MainClass.java

public static void main(String args[]) {
    Vector v1 = new Vector();
    v1.add("A");
    v1.add("B");/* ww  w .ja  v  a2 s .  co 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:MainClass.java

public static void main(String args[]) throws Exception {
    Vector v = new Vector();
    v.add("a");
    v.add("b");/*from w  w  w. jav a 2s.com*/
    v.add("c");

    Enumeration e = v.elements();
    while (e.hasMoreElements()) {
        Object o = e.nextElement();
        System.out.println(o);
    }
}

From source file:MainClass.java

public static void main(String args[]) {
    Vector v1 = new Vector();
    v1.add("A");
    v1.add("B");//  w w  w.j  ava2s . c o m
    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]);
    }
}

From source file:MainClass.java

public static void main(String args[]) {
    Vector v1 = new Vector();
    v1.add("A");
    v1.add("B");//from w ww .j  a  v  a2s  .c  o m
    v1.add("C");

    Vector v2 = new Vector();
    v2.add("A");
    v2.add("B");

    System.out.println(v1.equals(v2));
}