Example usage for java.util Vector addAll

List of usage examples for java.util Vector addAll

Introduction

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

Prototype

public boolean addAll(Collection<? extends E> c) 

Source Link

Document

Appends all of the elements in the specified Collection to the end of this Vector, in the order that they are returned by the specified Collection's Iterator.

Usage

From source file:gda.device.scannable.ScannableUtils.java

/**
 * @param scannables/*w  w  w .j  a  v a2s .  com*/
 * @return list of InputNames from the provided list of scannables
 */
public static List<String> getScannableInputFieldNames(List<Scannable> scannables) {
    Vector<String> fieldNames = new Vector<String>();
    for (Scannable s : scannables) {
        fieldNames.addAll(Arrays.asList(s.getInputNames()));
    }
    return fieldNames;
}

From source file:gda.device.scannable.ScannableUtils.java

/**
 * @param scannables/*from   ww  w .  jav a2s.  c  om*/
 * @return list of ExtraNames from the provided list of scannables
 */
public static List<String> getScannableExtraFieldNames(List<Scannable> scannables) {
    Vector<String> fieldNames = new Vector<String>();
    for (Scannable s : scannables) {
        fieldNames.addAll(Arrays.asList(s.getExtraNames()));
    }
    return fieldNames;
}

From source file:Main.java

DefaultMutableTreeNode addNodes(DefaultMutableTreeNode curTop, File dir) {
    DefaultMutableTreeNode curDir = new DefaultMutableTreeNode(dir);
    if (curTop != null) {
        curTop.add(curDir);/*  w  ww  .j  a  v a2 s . co m*/
    }
    File[] tmp = dir.listFiles();
    Vector<File> ol = new Vector<File>();
    ol.addAll(Arrays.asList(tmp));
    Collections.sort(ol, new Comparator<File>() {
        @Override
        public int compare(File o1, File o2) {
            int result = o1.getName().compareTo(o2.getName());
            if (o1.isDirectory() && o2.isFile()) {
                result = -1;
            } else if (o2.isDirectory() && o1.isFile()) {
                result = 1;
            }
            return result;
        }
    });
    for (int i = 0; i < ol.size(); i++) {
        File file = ol.elementAt(i);
        DefaultMutableTreeNode node = new DefaultMutableTreeNode(file);
        if (file.isDirectory()) {
            addNodes(node, file);
        }
        curDir.add(node);
    }
    return curDir;
}

From source file:com.symbian.driver.remoting.packaging.build.PackageBuilder.java

/**
 * @param directory//from   w w  w.  j  a v a  2  s.  c  o  m
 * @param filter
 * @param recurse
 * @return
 */
public static Collection<File> listFiles(File directory, FilenameFilter filter, boolean recurse) {
    // List of files / directories
    Vector<File> files = new Vector<File>();

    // Get files / directories in the directory
    File[] entries = directory.listFiles();

    // Go over entries
    for (int i = 0; i < entries.length; i++) {
        File entry = entries[i];

        // If there is no filter or the filter accepts the
        // file / directory, add it to the list
        if (filter == null || filter.accept(directory, entry.getName())) {
            files.add(entry);
        }

        // If the file is a directory and the recurse flag
        // is set, recurse into the directory
        if (recurse && entry.isDirectory()) {
            files.addAll(listFiles(entry, filter, recurse));
        }
    }

    // Return collection of files
    return files;
}

From source file:mzmatch.util.Tool.java

/**
 * //from www.  j a  va  2 s . c  o  m
 * 
 * @param pckgname
 * @return
 * @throws ClassNotFoundException
 */
public static Vector<Class<? extends Object>> getAllClasses(String pckgname) throws ClassNotFoundException {
    Vector<Class<? extends Object>> classes = new Vector<Class<? extends Object>>();

    // load the current package
    ClassLoader cld = Thread.currentThread().getContextClassLoader();
    if (cld == null)
        throw new ClassNotFoundException("Can't get class loader.");

    String path = pckgname.replace('.', '/');
    URL resource = cld.getResource(path);
    if (resource == null)
        throw new ClassNotFoundException("No resource for " + path);

    // parse the directory
    File directory = new File(resource.getFile());
    if (directory.isDirectory() && directory.exists()) {
        for (File f : directory.listFiles()) {
            if (f.getName().endsWith(".class"))
                classes.add(Class.forName(pckgname + '.' + f.getName().substring(0, f.getName().length() - 6)));
        }
        for (File f : directory.listFiles()) {
            if (f.isDirectory())
                classes.addAll(getAllClasses(pckgname + "." + f.getName()));
        }
    } else
        throw new ClassNotFoundException(pckgname + " does not appear to be a valid package");

    return classes;
}

From source file:Utils.CVEUtils.java

/**
 * Lookup a load of CVEs at once.//  w w  w.ja  v a  2  s  . c o  m
 *
 * @param cves
 * @return a vector of String[] with format { cveid, cvss_risk, summary }
 */
public Vector getCVEs(HashSet cves) {
    Vector answer = new Vector();
    ArrayList al = new ArrayList();

    Iterator it = cves.iterator();
    while (it.hasNext()) {
        String cve = (String) it.next();
        String[] cve_details = getCVE(cve);
        // If it is null then that vuln didn't exist.
        if (cve_details != null) {
            answer.add(cve_details);

            CVE c = new CVE();
            c.setCveId(cve_details[0]);
            c.setRiskScore(cve_details[1]);
            c.setSummary(cve_details[2]);

            al.add(c);

        } else {
            System.out.println("==CVEUtils=getCVEs: No local vuln for " + cve + ", consider updating");
        }
    }

    Collections.sort(al, Collections.reverseOrder());

    Vector actual_answer = new Vector();
    actual_answer.addAll(al);

    return actual_answer;
}

From source file:pt.lsts.neptus.plugins.trex.TrexTimelinePanel.java

public final Collection<String> getSeriesNames() {
    LinkedHashSet<String> series = new LinkedHashSet<>();
    series.addAll(this.series.keySet());
    Vector<String> col = new Vector<>();
    col.addAll(series);
    Collections.sort(col);/*from  w  w w. j a v  a2  s.com*/
    return col;
}

From source file:com.wxxr.nirvana.json.StrutsMockHttpServletRequest.java

public Enumeration getAttributeNames() {
    Vector v = new Vector();
    v.addAll(attributes.keySet());

    return v.elements();
}

From source file:org.jbpm.formModeler.service.bb.mvc.controller.RequestMultipartWrapper.java

/**
 * Returns the parameter names on the MultipartRequest that are of type file
 *
 * @return An Enumeration containing all the Parameter Names
 *///from ww  w. j  a  v a 2  s.  c  o m
public Enumeration getFileParameterNames() {
    Vector names = new Vector(requestFiles.size());
    names.addAll(requestFiles.keySet());
    return names.elements();
}

From source file:com.nineteendrops.tracdrops.client.core.multicall.MulticallImpl.java

public void registerCall(Class invokingClass, String tracMethodName, Object[] parameters, Class returnDecoder,
        ArrayList keptParametersForDecoder) {

    Vector callParameters = new Vector();
    if (parameters != null && parameters.length != 0) {
        callParameters.addAll(Arrays.asList(parameters));
    }/*www .j a  va2 s .c o m*/

    CallElement callElement = new CallElement(invokingClass, tracMethodName, callParameters, returnDecoder,
            keptParametersForDecoder);
    if (log.isDebugEnabled()) {
        logCallElement(callElement);
    }

    setMulticall(callElement);
}