Example usage for java.util Vector add

List of usage examples for java.util Vector add

Introduction

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

Prototype

public synchronized boolean add(E e) 

Source Link

Document

Appends the specified element to the end of this Vector.

Usage

From source file:no.met.jtimeseries.netcdf.NetcdfMeteogramWrapper.java

private static void scenario2() throws Exception {
    String url = "http://dev-vm188.met.no/thredds/dodsC/cryoclim/indicators/myfile.nc";
    Vector<String> parameters = new Vector<String>();
    parameters.add("gsl[1]");
    parameters.add("gsl[2]");
    String header = "AUTO";
    showChart(getChart(url, null, parameters, ParameterReference.VARIABLE_NAME, header));
}

From source file:Main.java

public static synchronized Node[] getChildNodes(Node node) {
    if (node == null) {
        return null;
    }// w w  w  .  j  a  va 2 s . c  om
    Vector childs = new Vector();
    for (Node n = node.getFirstChild(); n != null; n = n.getNextSibling()) {
        childs.add((Element) n);
    }
    Node[] childNodes = new Element[childs.size()];
    childs.toArray(childNodes);
    return childNodes;
}

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  ww  w .j  a va 2s . c  o  m*/
    }
    return setVector;
}

From source file:Main.java

public static String[] getPuzzleFiles(Context context) {
    String[] files = context.fileList();
    Vector<String> puzzleFiles = new Vector<String>();
    for (String file : files)
        if (file.endsWith(".pfy"))
            puzzleFiles.add(file);
    String[] ret = new String[0];
    return puzzleFiles.toArray(ret);
}

From source file:Main.java

public static <T> List<T> uniqueList(List<T> list) {
    Vector<T> v = new Vector<T>();
    for (T obj : list) {
        if (!v.contains(obj)) {
            v.add((T) obj);
        }/*w w w.j a  v  a2s  . c  o  m*/
    }
    return v;
}

From source file:Main.java

public static Vector<String> readXMLNode222(String xmlFile, String xpath) {
    try {/* ww  w .  j  av  a2s. co  m*/
        XPathFactory factory = XPathFactory.newInstance();
        XPath xPath = factory.newXPath();
        // XPathExpression xPathExpression =
        // xPath.compile("/history");
        File xmlDocument = new File(xmlFile);
        InputSource inputSource = new InputSource(new FileInputStream(xmlDocument));
        // String root = xPath.evaluate("/", inputSource);
        NodeList nodes = (NodeList) xPath.evaluate(xpath, inputSource, XPathConstants.NODESET);
        Vector<String> vector = new Vector<String>();
        for (int x = 0; x < nodes.getLength(); x++) {
            vector.add(nodes.item(x).getTextContent());
        }
        return vector;
    } catch (Exception ex) {
        ex.printStackTrace();
        return new Vector();
    }
}

From source file:Main.java

public static <T> Vector<T> asVector(T[] args)
/*     */ {//from   w w w  .j a va 2  s  .c o m
    /* 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

/** Adds an object to a list if not already contained. */
public static void tryAdd(Vector vector, Object object) {
    if (object == null) {
        return;/*from w ww  . java 2s.co  m*/
    }
    if (!vector.contains(object)) {
        vector.add(object);
    }
}

From source file:Main.java

/**
 * Method getDropDownOptions.//from  w  w  w.j  a  v a 2 s  .  com
 *
 * @param vector        Vector
 * @param valueGetter   String
 * @param textGetter    String
 * @param selectedValue Object
 * @return String
 * @throws NoSuchMethodException
 * @throws IllegalAccessException
 * @throws InvocationTargetException
 */
public static String getDropDownOptions(Vector vector, String valueGetter, String textGetter,
        Object selectedValue) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
    Vector selectedValues = new Vector();
    if (selectedValue != null) {
        selectedValues.add(selectedValue);
    }
    return getDropDownOptions(vector, valueGetter, textGetter, selectedValues);
}

From source file:Main.java

public static String[] fecthAllTimeZoneIds() {
    Vector<String> v = new Vector<String>();
    String[] ids = TimeZone.getAvailableIDs();
    for (int i = 0; i < ids.length; i++) {
        v.add(ids[i]);
    }//from  w  ww.j a v  a2  s  .c  om
    java.util.Collections.sort(v, String.CASE_INSENSITIVE_ORDER);
    v.copyInto(ids);
    v = null;
    return ids;
}