List of usage examples for java.util Vector Vector
public Vector(Collection<? extends E> c)
From source file:Main.java
/** * Parses the array to the vector.// w w w . ja v a2 s . c o m * @param array the array * @return the instance of Vector */ public static Vector parseVector(Object[] array) { return new Vector(Arrays.asList(array)); }
From source file:Main.java
public static <T> Vector<T> asVector(T[] args) /* */ {/*from ww w . j av a2s . c om*/ /* 379 */if (args == null) /* */ { /* 381 */return null; /* */} /* */ /* 384 */Vector vResult = new Vector(args.length); /* */ /* 386 */for (Object t : args) /* */ { /* 388 */vResult.add(t); /* */} /* */ /* 391 */return vResult; /* */}
From source file:Main.java
/** * * @param <T>/*from w w w .jav a2s . c om*/ * @param list * @param fromIndex * @param toIndex * @return */ public static <T> List<T> subList(List<T> list, int fromIndex, int toIndex) { List<T> subList = new Vector<T>(toIndex - fromIndex); for (int i = Math.max(0, fromIndex); ((i < toIndex) && (i < list.size())); i++) { T obj = list.get(i); subList.add(obj); } return subList; }
From source file:Main.java
/** * * @param <T>//from w w w. j a v a2 s . co m * @param list * @param fromIndex * @param toIndex * @return */ public static <T> List<T> subListReverse(List<T> list, int fromIndex, int toIndex) { List<T> subList = new Vector<T>(fromIndex - toIndex); for (int i = Math.min(fromIndex, list.size()) - 1; (i >= toIndex) && (i >= 0); i--) { T obj = list.get(i); subList.add(obj); } return subList; }
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 w w . j a va 2s . c o m*/ } return values; }
From source file:Main.java
/** * <p>toVector.</p>/*from w ww . j av a 2 s .c o m*/ * * @param objects a T object. * @param <T> a T object. * @return a {@link java.util.Vector} object. */ public static <T> Vector<T> toVector(T... objects) { return new Vector<T>(Arrays.asList(objects)); }
From source file:Main.java
public static Vector<String> extractList(Element elem, String name) { NodeList nl = elem.getElementsByTagName(name); Vector<String> values = new Vector<String>(nl.getLength()); String retval = null;//from ww w.j a v a 2 s . c om for (int n = 0; n < nl.getLength(); n++) { Element element = (Element) nl.item(n); retval = getSimpleElementText(element); if (retval != null) values.addElement(retval); } return values; }
From source file:Main.java
public static Vector<Element> getChildList(Element elem, String elementName) { if (elem == null) return null; NodeList nl = elem.getChildNodes(); if (nl == null) return null; Vector<Element> retlist = new Vector<Element>(100); for (int n = 0; n < nl.getLength(); n++) { Element element = (Element) nl.item(n); if (elementName.equals(element.getTagName())) { retlist.addElement(element); }//w ww. ja v a2 s .co m } if (retlist.size() == 0) return null; return retlist; }
From source file:Main.java
/** * Parses the list to the vector.// www . j av a 2 s . c om * @param list the instance of List * @return the instance of Vector */ public static Vector parseVector(List list) { return new Vector(list); }
From source file:Main.java
public static Enumeration getAllFilesIn(File dir) { File[] files;/*from ww w . j av a 2s.com*/ if (dir.isDirectory()) { files = dir.listFiles(new FileFilter() { public boolean accept(File f) { if (f.isDirectory()) return false; return (f.getName().endsWith(".txt")); } }); Arrays.sort(files); } else { files = new File[] { dir }; } Vector vect = new Vector(files.length); for (int i = 0; i < files.length; ++i) vect.addElement(files[i]); return vect.elements(); }