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:org.executequery.gui.browser.FindAction.java

protected void foundValues(List<T> values) {

    Vector<T> listData = new Vector<T>(values.size());
    listData.addAll(values);

    resultsList.setListData(listData);/*  w w w.j ava2s. c  o  m*/
}

From source file:jmxsh.ListCmd.java

public void cmdProc(Interp interp, TclObject argv[]) throws TclException {

    try {/* w w w  .j av a 2  s  . c  o  m*/
        CommandLine cl = parseCommandLine(argv);
        String args[] = cl.getArgs();
        String[] expressions = null;

        if (cl.hasOption("help")) {
            new HelpFormatter().printHelp("jmx_list [-?] [-s server] domain_regex:mbean_regex",
                    "======================================================================", this.opts,
                    "======================================================================", false);
            System.out.println("jmx_list retrieves the list of known mbeans for the given");
            System.out.println("server.  It takes a pair of regex expressions separated by");
            System.out.println("colon.  The first is an expression for the domain, the");
            System.out.println("second is an expression for the mbean.");
            System.out.println("");
            System.out.println("It will return a list of tcl strings.");
            return;
        }

        listDefaults(interp);

        this.server = cl.getOptionValue("server", this.server);

        if (args.length > 0) {
            expressions = args[0].split(":");
        }

        if (this.server == null) {
            throw new TclException(interp, "No server specified; please set SERVER variable or use -s option.",
                    TCL.ERROR);
        }

        String domain_regex = (expressions != null && expressions.length > 0) ? expressions[0] : "";
        String mbean_regex = (expressions != null && expressions.length > 1) ? expressions[1] : "";

        String[] domains = Jmx.getInstance().getDomains(this.server, domain_regex);
        Vector<String> beans = new Vector<String>();
        for (String domain : domains) {
            List<String> list = Arrays.asList(Jmx.getInstance().getMBeans(this.server, domain, mbean_regex));
            beans.addAll(list);
        }

        String[] emptyStringArray = new String[0];
        TclObject result = Utils.array2list(beans.toArray(emptyStringArray));
        interp.setResult(result);
    } catch (ParseException e) {
        throw new TclException(interp, e.getMessage(), 1);
    } catch (RuntimeException e) {
        throw new TclException(interp, "Cannot convert result to a string.", 1);
    }
}

From source file:org.openmrs.module.openhmis.cashier.web.controller.CashierMessageRenderController.java

@RequestMapping(method = RequestMethod.GET)
public ModelAndView render(HttpServletRequest request) {
    // object to store keys from cashier and backboneforms
    Vector<String> keys = new Vector<String>();

    // locate and retrieve cashier messages
    Locale locale = RequestContextUtils.getLocale(request);
    ResourceBundle resourceBundle = ResourceBundle.getBundle("messages", locale);

    // store cashier message keys in the vector object
    keys.addAll(resourceBundle.keySet());

    // retrieve backboneforms messages
    BackboneMessageRenderController backboneController = new BackboneMessageRenderController();
    ModelAndView modelAndView = backboneController.render(request);

    // store backboneforms message keys in the vector object
    for (Map.Entry<String, Object> messageKeys : modelAndView.getModel().entrySet()) {
        Enumeration<String> messageKey = (Enumeration<String>) messageKeys.getValue();
        while (messageKey.hasMoreElements()) {
            String key = messageKey.nextElement();
            if (!keys.contains(key))
                keys.add(key);/*from  w w w.ja va  2  s.  c o  m*/
        }
    }

    return new ModelAndView(CashierWebConstants.MESSAGE_PAGE, "keys", keys.elements());
}

From source file:marytts.util.io.FileUtils.java

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 (File entry : entries) {
        // 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);/*w  w w .  ja  v a  2  s  .  c o  m*/
        }

        // 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:edu.uga.cs.fluxbuster.clustering.hierarchicalclustering.DistanceMatrix.java

/**
 * Populate distance matrix from a list of matrix values specified in row
 * major order.//from   w w  w  .j a  v  a  2s . co m
 * 
 * @param vals
 *            the matrix values
 */
private void populateDistanceMatrix(Vector<Float> vals) {
    int matrixdim = (int) Math.ceil(Math.sqrt(2 * vals.size()));

    int length = matrixdim - 1;
    int start = 0;
    for (int i = 0; i < matrixdim - 1; i++) {
        Vector<Float> row = new Vector<Float>();
        row.addAll(vals.subList(start, start + length));
        distMatrix.add(row);
        start += length;
        length--;
    }
}

From source file:org.apache.fop.complexscripts.bidi.DelimitedTextRange.java

/**
 * <p>Assign resolved levels to all text intervals of this delimited text range.</p>
 * <p>Has a possible side effect of replacing the intervals array with a new array
 * containing new text intervals, such that each text interval is associated with
 * a single level run.</p>/*from www  . j  a v a2  s.com*/
 * @param levels array of levels each corresponding to each index of the delimited
 * text range
 */
private void assignLevels(int[] levels) {
    Vector intervalsNew = new Vector(intervals.size());
    for (Iterator it = intervals.iterator(); it.hasNext();) {
        TextInterval ti = (TextInterval) it.next();
        intervalsNew.addAll(assignLevels(ti, levels));
    }
    if (!intervalsNew.equals(intervals)) {
        intervals = intervalsNew;
    }
}

From source file:org.miradi.xml.TestXmpz2ForwardMigration.java

public void testAdditionOfUUIDFields() throws Exception {
    Document document = convertProjectToDocument();
    Element rootElement = document.getDocumentElement();

    NodeList childNodes = rootElement.getChildNodes();

    Vector<ImmutablePair<Node, Node>> nodesToRemove = new Vector<ImmutablePair<Node, Node>>();

    for (int index = 0; index < childNodes.getLength(); ++index) {
        Node node = childNodes.item(index);
        nodesToRemove.addAll(removeUUIDFields(node));
    }/*from w  w  w .j  a  va  2s.c o m*/

    for (ImmutablePair<Node, Node> nodePair : nodesToRemove) {
        nodePair.right.removeChild(nodePair.left);
    }

    verifyMigratedXmpz2(document);
}

From source file:org.mili.core.templating.TemplateStore.java

/**
 * List all included templates by their names.
 *
 * @return List with all template names.
 *//*from w  ww . j a v  a 2  s .  com*/
public String[] listTemplates() {
    Vector<String> v = new Vector<String>();
    v.addAll(this.templates.keySet());
    return (String[]) v.toArray(new String[] {});
}

From source file:org.openflexo.foundation.ie.widget.IEBlocWidget.java

public Vector<IETextFieldWidget> getAllDateTextfields() {
    Vector<IETextFieldWidget> v = new Vector<IETextFieldWidget>();
    if (_innerBloc != null) {
        v.addAll(_innerBloc.getAllDateTextfields());
    }/*from w  w  w  . jav  a 2s .com*/
    return v;
}

From source file:org.openflexo.foundation.ie.widget.IEBlocWidget.java

@Override
public Vector<IEHyperlinkWidget> getAllButtonInterface() {
    Vector<IEHyperlinkWidget> v = new Vector<IEHyperlinkWidget>();
    if (_innerBloc != null) {
        v.addAll(_innerBloc.getAllButtonInterface());
    }//  w  w w.  j  av a2 s  .co m
    if (getButtonList() != null) {
        v.addAll(getButtonList().getAllButtonInterface());
    }
    return v;
}