Java Vector Create createVector(Object[] array)

Here you can find the source of createVector(Object[] array)

Description

create Vector

License

Open Source License

Parameter

Parameter Description
array an Object[]

Return

a Vector with contents of the Object[]

Declaration

public static Vector createVector(Object[] array) 

Method Source Code

//package com.java2s;
import java.util.*;

public class Main {
    /**/*  w ww. j  a  va 2 s .co m*/
     * @return a Vector with contents of the Iterator
     * @param iterator the Iterator object
     */
    public static Vector createVector(Iterator iterator) {
        Vector v = new Vector();

        while (iterator.hasNext())
            v.addElement(iterator.next());

        return v;
    }

    /**
     * @return a Vector with contents of the List
     * @param iterator the Iterator object
     */
    public static Vector createVector(List list) {
        return createVector(list.iterator());
    }

    /**
     * @return a Vector with contents of the Enumeration 
     * @param e the Enumeration object
     */
    public static Vector createVector(Enumeration e) {
        Vector v = new Vector();

        while (e.hasMoreElements())
            v.addElement(e.nextElement());

        return v;
    }

    /**
     * @return a Vector with contents of the Object[] 
     * @param array an Object[]
     */
    public static Vector createVector(Object[] array) {
        Vector v = new Vector();

        for (int i = 0; i < array.length; ++i)
            v.addElement(array[i]);

        return v;
    }
}

Related

  1. makeVector(String[] O)
  2. parseLinesFromLast(byte[] bytearray, int lineCount, Vector lastNlines)
  3. tokenVector(String s, String delimiters)
  4. ToVector(byte[] in)