Example usage for java.util Vector Vector

List of usage examples for java.util Vector Vector

Introduction

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

Prototype

public Vector() 

Source Link

Document

Constructs an empty vector so that its internal data array has size 10 and its standard capacity increment is zero.

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 www  .j a  va 2s  .  com*/
}

From source file:Main.java

public static void main(String args[]) {
    Vector<String> v = new Vector<String>();
    v.add("Hello");
    v.add("Hello");
    String s = v.get(0);/*w  ww  .j a  v  a  2  s . co  m*/
    System.out.println(s);
}

From source file:MainClass.java

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

    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");/*  ww w .ja va 2 s  . c  o m*/
    v1.add("B");
    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");/*from w w w  .j  av  a 2s. co  m*/
    v.add("B");

    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[]) {
    Vector v1 = new Vector();
    v1.add("A");/*w w w.java2  s  . com*/
    v1.add("B");
    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");/*w w w .  j  a  va2s . c  om*/
    v1.add("B");
    v1.add("C");

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

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

From source file:Main.java

public static void main(String args[]) {
    Vector<String> v1 = new Vector<String>();
    v1.add("A");/*from   ww  w  .j a  va 2 s  . c o  m*/
    v1.add("B");
    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> v = new Vector<String>();
    v.add("1");//from ww  w  . java2 s  .c  o m
    v.add("2");
    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");//from w  ww .j  av a  2 s .c o m
    v1.add("B");
    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]);
    }
}