Example usage for java.util ArrayList addAll

List of usage examples for java.util ArrayList addAll

Introduction

In this page you can find the example usage for java.util ArrayList 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 list, in the order that they are returned by the specified collection's Iterator.

Usage

From source file:cool.pandora.modeller.ui.BagTableFormBuilder.java

/**
 * addList.// w  w w. j  av  a 2 s  .  co  m
 *
 * @param isRequired   boolean
 * @param label        String
 * @param elements     Collection
 * @param defaultValue String
 * @param checkbox     JComponent
 * @return addBinding
 */
public JComponent[] addList(final boolean isRequired, final String label, final Collection<String> elements,
        final String defaultValue, final JComponent checkbox) {
    final ArrayList<String> listModel = new ArrayList<>();
    listModel.addAll(elements);

    // Set default value selected from value list
    final JComboBox<String> dropDownTextField = new JComboBox<>(
            listModel.toArray(new String[listModel.size()]));
    dropDownTextField.setSelectedItem(defaultValue);
    final Object obj = dropDownTextField.getSelectedItem();
    dropDownTextField.setSelectedItem(obj);

    return addBinding(isRequired, label, dropDownTextField, checkbox);
}

From source file:com.groupon.jenkins.dynamic.build.DynamicProjectBranchTabsProperty.java

private ArrayList<String> parseBranches() {
    ArrayList<String> parsedBranches = new ArrayList<String>();
    if (!StringUtils.isEmpty(branchTabs)) {
        parsedBranches.addAll(trim());
    }/*  www  .  ja v a  2  s . c  o  m*/
    return parsedBranches;
}

From source file:edu.vt.vbi.patric.jbrowse.CRResultSet.java

public void addToDefaultTracks(CRTrack crTrk) {
    if (pinGenome.equals(crTrk.getGenomeID())) {
        ArrayList<String> newTrack = new ArrayList<String>();
        newTrack.add("CR" + crTrk.getRowID());
        newTrack.addAll(defaultTracks);
        defaultTracks = newTrack;//  w  w  w  .  j a  v  a  2  s .  c om
    } else {
        defaultTracks.add("CR" + crTrk.getRowID());
    }
}

From source file:$.ExampleLogicImpl.java

/**
     * {@inheritDoc}/*w ww  .  j ava  2s . c o  m*/
     */
    public List<SitePage> getPages() {
        ArrayList<SitePage> pages = new ArrayList<SitePage>();
        Site site = getCurrentSite();
        if (site != null) {
            pages.addAll(site.getPages());
        }
        return pages;
    }

From source file:com.amazon.janusgraph.diskstorage.dynamodb.DynamoDBDelegate.java

public static boolean areGSIsSameConfiguration(List<GlobalSecondaryIndexDescription> g1,
        List<GlobalSecondaryIndexDescription> g2) {
    if (g1 == null) {
        if (g2 == null) {
            return true;
        }/*from  w w  w  . jav  a2 s.  c  o m*/
        return false;
    }
    if (g1.size() != g2.size()) {
        return false;
    }
    // make copy of the lists because we don't want to mutate the lists
    ArrayList<GlobalSecondaryIndexDescription> g1clone = new ArrayList<>(g1.size());
    g1clone.addAll(g1);
    ArrayList<GlobalSecondaryIndexDescription> g2clone = new ArrayList<>(g2.size());
    g1clone.addAll(g2);

    for (GlobalSecondaryIndexDescription gi1 : g1) {
        for (GlobalSecondaryIndexDescription gi2 : g2) {
            if (areGSIsSameConfiguration(gi1, gi2)) {
                g1clone.remove(gi1);
                g2clone.remove(gi2);
                break;
            }
        }
    }
    return g1clone.isEmpty() || g2clone.isEmpty();
}

From source file:eu.bittrade.libs.steemj.configuration.PrivateKeyStorage.java

/**
 * Get a list of account names for which private keys have been stored.
 * //w  w  w . j  a  v a 2 s.  co m
 * @return A list of account names for which private keys have been stored.
 */
public List<AccountName> getAccounts() {
    ArrayList<AccountName> storedAccounts = new ArrayList<>();
    storedAccounts.addAll(this.getPrivateKeysPerAccounts().keySet());
    return storedAccounts;
}

From source file:com.dtolabs.rundeck.core.execution.script.ExecTaskParameterGeneratorImpl.java

/**
 *
 * @throws ExecutionException if an error occurs
 * @param nodeentry/* w  ww . ja v  a2 s. co  m*/
 * @param command
 * @param scriptfile
 * @param args
 */
public ExecTaskParameters generate(final INodeEntry nodeentry, final boolean command, final File scriptfile,
        final String[] args) throws ExecutionException {
    final String commandexecutable;
    final String[] commandargs;

    if (!command && null == scriptfile) {
        throw new ExecutionException("Could not determine the command to dispatch");
    }
    if ("windows".equals(nodeentry.getOsFamily())) {
        //TODO: escape args properly for windows
        commandexecutable = "cmd.exe";
        if (command) {
            ArrayList<String> list = new ArrayList<String>();
            list.add(0, "/c");
            list.addAll(Arrays.asList(args));
            commandargs = list.toArray(new String[list.size()]);
        } else if (null != scriptfile) {
            //commandString is the script file location
            ArrayList<String> list = new ArrayList<String>();
            list.add(scriptfile.getAbsolutePath());
            if (args != null && args.length > 0) {
                list.addAll(Arrays.asList(args));
            }
            list.add(0, "/c");
            commandargs = list.toArray(new String[list.size()]);
        } else {
            throw new ExecutionException("Could not determine the command to dispatch");
        }
    } else {
        if (command) {
            commandexecutable = "/bin/sh";
            commandargs = new String[] { "-c", StringUtils.join(args, " ") };
        } else if (null != scriptfile) {
            final String scriptPath = scriptfile.getAbsolutePath();
            commandexecutable = scriptPath;
            commandargs = args;
        } else {
            throw new ExecutionException("Could not determine the command to dispatch");
        }
    }
    return new ExecTaskParameters() {
        public String getCommandexecutable() {
            return commandexecutable;
        }

        public String[] getCommandArgs() {
            return commandargs;
        }
    };
}

From source file:io.jjcastillo.bconferencia.helper.Storage.java

public boolean addConferencia(Conferencia conferencia, int auditorio) {

    ArrayList<Conferencia> confs = new ArrayList();
    confs.addAll((1 == auditorio ? auditorio1 : auditorio2).getConferencias());
    // confs.addAll(auditorio2.getConferencias());

    for (Conferencia conf : confs) {
        // if (conf.getNombre().equalsIgnoreCase(conferencia.getNombre())) {
        if (HelperUtil.overlapDate(conf.getFechaInicio(), conf.getFechaFin(), conferencia.getFechaInicio(),
                conferencia.getFechaFin())) {
            System.out.println("Ya existe una conferencia en es horario");
            return false;
        }//from   ww  w  .j a  va  2s  .  com
        //}
    }
    (1 == auditorio ? auditorio1 : auditorio2).addConferencia(conferencia);
    saveAll();
    return true;
}

From source file:io.jjcastillo.bconferencia.helper.Storage.java

public ArrayList<Conferencia> getAllConferencias() {
    ArrayList a = new ArrayList<>(auditorio1.getConferencias());
    a.addAll(auditorio2.getConferencias());
    return a;/* ww w. ja  va 2s. c o m*/

}

From source file:com.ibm.cloud.appid.android.LicenseCheck.java

private List<File> getListFiles(File parentDir) {
    ArrayList<File> inFiles = new ArrayList<File>();
    File[] files = parentDir.listFiles();
    for (File file : files) {
        if (file.isDirectory()) {
            inFiles.addAll(getListFiles(file));
        } else {// w  ww  .  j ava2s  .c  o m
            if (file.getName().endsWith(".java")) {
                inFiles.add(file);
            }
        }
    }
    return inFiles;
}