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:Main.java

public static Vector toVector(Object[] src) {
    return toVector(src, new Vector());
}

From source file:Main.java

public static Vector arrayToVector(Object[] list) {
    Vector v = new Vector();
    for (int i = 0; i < list.length; i++)
        v.add(list[i]);/*from  ww  w. j a  v  a2  s  . c om*/
    return (v);
}

From source file:Main.java

public static void createVector() {
    mVector = new Vector<String>();
}

From source file:Main.java

private static Vector<Integer> defaireDonnee(String donnee) {
    Vector<Integer> vectBit = new Vector<Integer>();

    //On insert les valeurs du string recu dans le vecteur
    while (donnee.length() != 0) {
        vectBit.addElement(Integer.parseInt(donnee.substring(0, 1)));
        donnee = donnee.substring(1);/*w w w .j a  va 2s .  c  om*/
    }

    return vectBit;
}

From source file:Main.java

public static Vector arrayToVector(Object[] array) {
    Vector data = new Vector();
    arrayToCollection(data, array);
    return data;
}

From source file:Main.java

public static Collection and(Collection collection1, Collection collection2) {
    Vector completeList = new Vector();

    if (collection2 == null)
        return completeList;
    Iterator i = collection2.iterator();
    while (i.hasNext()) {
        Object addlItem = i.next();
        if (collection1.contains(addlItem) == true) {
            completeList.addElement(addlItem);
        }/*from www  .j a v  a 2s  . co  m*/
    }
    return completeList;
}

From source file:Main.java

public static String[] split(String original, String separator) {
    Vector nodes = new Vector();

    // Parse nodes into vector
    int index = original.indexOf(separator);
    while (index >= 0) {
        nodes.addElement(original.substring(0, index));
        original = original.substring(index + separator.length());
        index = original.indexOf(separator);
    }//from w w  w  . j  a  v  a2s.  com
    // Get the last node
    nodes.addElement(original);

    // Create splitted string array
    String[] result = new String[nodes.size()];
    if (nodes.size() > 0) {
        for (int loop = 0; loop < nodes.size(); loop++)
            result[loop] = (String) nodes.elementAt(loop);
    }
    return result;
}

From source file:Main.java

public static final <E> Vector<E> createVector(E... elements) {
    Vector<E> list = new Vector<E>();
    addToCollection(list, elements);/*from   w  w  w  . ja  v  a 2  s  .  c o  m*/
    return list;
}

From source file:Main.java

public static Vector setToVector(Set set) {
    Vector setVector = new Vector();
    if (set != null) {
        for (Iterator i = set.iterator(); i.hasNext();) {
            setVector.add(i.next());//from   w  w  w  .  j a va2 s. c o m
        }
    }
    return setVector;
}

From source file:Main.java

private static Vector<String> getTag(String source, String tag) {
    Vector<String> sTag = new Vector<String>();
    if (source == null || source.isEmpty() || tag == null || tag.isEmpty())
        return sTag;

    String subString, sTemp;/*from ww  w . j  a  v  a 2s  .  c  o m*/
    int start, end;

    subString = source;
    sTemp = "<" + tag;
    start = subString.indexOf(sTemp);
    while (start >= 0) {
        subString = subString.substring(start);
        sTemp = "</" + tag + ">";
        end = subString.indexOf(sTemp);
        if (end < 0)
            break;

        end += sTemp.length();
        sTag.add(subString.substring(0, end));

        subString = subString.substring(end);
        sTemp = "<" + tag;
        start = subString.indexOf(sTemp);
    }
    return sTag;
}