List of usage examples for java.util Vector addElement
public synchronized void addElement(E obj)
From source file:Main.java
public static Vector tail(Vector v) { Vector result = new Vector(); Enumeration e = v.elements(); e.nextElement();// w w w. j av a 2s . c om while (e.hasMoreElements()) result.addElement(e.nextElement()); return result; }
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);/*from w w w .jav a 2 s. c om*/ } return vectBit; }
From source file:Main.java
public static Vector copy(Vector v) { Vector copy = new Vector(); synchronized (v) { for (Enumeration en = v.elements(); en.hasMoreElements();) { copy.addElement(en.nextElement()); }//from w ww . java2s . c om } return copy; }
From source file:Main.java
public static Vector appendInto(Vector dest, Vector src) { Enumeration e = src.elements(); while (e.hasMoreElements()) dest.addElement(e.nextElement()); return dest;// ww w .ja v a 2 s. co m }
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); }/* w w w .j a va 2s . 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 Vector appendInto(Vector v, Object[] array, int quantity) { v.ensureCapacity(v.size() + quantity); for (int i = 0; i < quantity; i++) { v.addElement(array[i]); }//from w w w . j av a 2 s . c o m return v; }
From source file:Main.java
private static String[] filter(String[] p_array, boolean p_includeComments) { String[] result = p_array;/* w w w . j a v a 2s. c o m*/ if (!p_includeComments) { Vector v = new Vector(); for (int i = 0; i < p_array.length; i++) { String s = p_array[i]; if (s.indexOf("<!--") < 0) { v.addElement(s); } } result = new String[v.size()]; for (int i = 0; i < v.size(); i++) { result[i] = (String) v.elementAt(i); } } return result; }
From source file:Main.java
public static Vector getDirectories(Node node) { NodeList nList = node.getChildNodes(); Vector directoryNodes = new Vector(); for (int i = 0; i < nList.getLength(); i++) { Node kidNode = nList.item(i); if (kidNode.getNodeName().equals("directory")) { directoryNodes.addElement(kidNode); }//from www . j a va 2 s . c om } return directoryNodes; }
From source file:Main.java
public static Vector getSetColorNodes(Node node) { NodeList nList = node.getChildNodes(); Vector propertySetNodes = new Vector(); for (int i = 0; i < nList.getLength(); i++) { Node kidNode = nList.item(i); if (kidNode.getNodeName().equals("setColor")) { propertySetNodes.addElement(kidNode); }//from w w w . ja v a 2 s. c o m } return propertySetNodes; }
From source file:Main.java
public static Vector<Element> extractElementList(Element elem, String name) { NodeList nl = elem.getElementsByTagName(name); Vector<Element> values = new Vector<Element>(nl.getLength()); for (int n = 0; n < nl.getLength(); n++) { Element element = (Element) nl.item(n); if (element != null) values.addElement(element); }//w ww . j av a 2 s. c o m return values; }