Example usage for java.util Vector elements

List of usage examples for java.util Vector elements

Introduction

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

Prototype

public Enumeration<E> elements() 

Source Link

Document

Returns an enumeration of the components of this vector.

Usage

From source file:EnumerationIterator1.java

public static void main(String args[]) {
    String elements[] = { "Java", "Source", "and", "Support", "." };
    Vector v = new Vector(Arrays.asList(elements));
    Enumeration e = v.elements();
    Iterator itor = EnumerationIterator1.iterator(e);
    while (itor.hasNext()) {
        System.out.println(itor.next());
    }//from  w ww .  j av a2 s .  c om
}

From source file:MainClass.java

public static void main(String args[]) {
    Vector<String> v = new Vector<String>();
    v.add("A");// w w w  .j  a  v  a 2s . co m
    v.add("B");

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

From source file:MainClass.java

public static void main(String args[]) throws Exception {
    Vector v = new Vector();
    v.add("a");/*from   www .j a  v  a 2 s  . c o m*/
    v.add("b");
    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[]) throws Exception {
    Vector v = new Vector();
    v.add("a");//from   ww w .j av a 2  s  .  co  m
    v.add("b");
    v.add("c");

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

From source file:net.vnt.ussdapp.util.ContextTest.java

public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext(new String[] { "/context.xml" });
    ContextProperties ctxProp = (ContextProperties) Context.getInstance().getBean("ContextProperties");
    TXTParser parser = (TXTParser) Context.getInstance().getBean("TXTParser");
    String mainmenu = ctxProp.getProperty("ussdapp.wrong");
    try {//from w  w w .  ja  v  a 2s. c  om
        Vector<String> vs = parser.readFields(mainmenu);
        Enumeration<String> ens = vs.elements();
        StringBuilder sb = new StringBuilder();
        while (ens.hasMoreElements()) {
            sb.append(ens.nextElement()).append("\n");
        }
        System.out.println(sb.toString());
    } catch (IOException ex) {
        Logger.getLogger(ContextTest.class.getName()).log(Level.SEVERE, null, ex);
    }
    System.out.println(System.getProperty("os.arch"));
}

From source file:MainClass.java

public static void main(String args[]) {

    Vector vector = new Vector();
    vector.addElement(new Integer(5));
    vector.addElement(new Float(-14.14f));
    vector.addElement(new String("Hello"));

    Enumeration e = vector.elements();
    while (e.hasMoreElements()) {
        Object obj = e.nextElement();
        System.out.println(obj);/*  w  w  w  .ja  v a  2  s.  c  o  m*/
    }
}

From source file:Main.java

public static void main(String[] args) {
    Vector<String> v = new Vector<String>();
    v.add("A");// w  ww .  j a v a  2  s  .  c  o m
    v.add("B");
    v.add("D");
    v.add("E");
    v.add("F");

    System.out.println(v);
    Enumeration e = v.elements();

    ArrayList<String> aList = Collections.list(e);
    System.out.println(aList);
}

From source file:Main.java

public static void main(String[] args) {
    Vector<String> v = new Vector<String>();
    v.add("A");/*from w w w .  j a  v  a 2 s.c  o  m*/
    v.add("B");
    v.add("D");
    v.add("E");
    v.add("F");

    System.out.println(v);
    Enumeration<String> e = v.elements();

    ArrayList<String> aList = Collections.list(e);
    System.out.println(aList);
}

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;/* www . jav  a  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<Integer> vec = new Vector<Integer>(4);

    vec.add(4);/*  w  ww . j  a  v a 2 s . com*/
    vec.add(3);
    vec.add(2);
    vec.add(1);

    // adding elements into the enumeration
    Enumeration e = vec.elements();

    // let us print all the elements available in enumeration
    System.out.println("Numbers in the enumeration are :- ");
    while (e.hasMoreElements()) {
        System.out.println("Number = " + e.nextElement());
    }
}