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:com.tesora.dve.sql.util.PEDDL.java

@Override
public List<String> getSetupDrops() {
    ArrayList<String> buf = new ArrayList<String>();
    ArrayList<String> nativeDrops = new ArrayList<String>();
    for (DatabaseDDL dbddl : getDatabases()) {
        buf.addAll(dbddl.getSetupDrops());
        for (StorageGroupDDL sgddl : persGroups) {
            nativeDrops.addAll(sgddl.getSetupDrops(dbddl.getDatabaseName()));
        }/* ww w  .  j  av a  2s. co m*/
    }
    buf.addAll(nativeDrops);
    return buf;
}

From source file:edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation.java

/**
 * Check if a List of Literals has any XSS problems.
 * Return null if there are none and return an error message if there are problems.
 */// w  ww . j  av a  2 s  .c  o  m
private String literalHasXSS(List<Literal> list) throws ScanException, PolicyException {
    AntiSamy antiSamy = AntiScript.getAntiSamyScanner();

    ArrayList errorMsgs = new ArrayList();
    for (Literal literal : list) {
        if (literal != null) {
            CleanResults cr = antiSamy.scan(literal.getLexicalForm());
            errorMsgs.addAll(cr.getErrorMessages());

            String dt = literal.getDatatypeURI();
            if (dt != null) {
                cr = antiSamy.scan(dt);
                errorMsgs.addAll(cr.getErrorMessages());
            }

            String lang = literal.getLanguage();
            if (lang != null) {
                cr = antiSamy.scan(lang);
                errorMsgs.addAll(cr.getErrorMessages());
            }
        }
    }

    if (errorMsgs.isEmpty())
        return null;
    else
        return StringUtils.join(errorMsgs, ", ");

}

From source file:com.yarg.animatronics.datamodel.PwmMotor.java

/**
 * Return a copy of the animation keys list for this motor.
 * @return Copy of the animation keys list for this motor.
 *//*w w  w .  j a  v  a 2s  .co m*/
protected List<AnimationKey> getAnimationKeys() {
    ArrayList<AnimationKey> copyOfAnimationKeys = new ArrayList<>();
    copyOfAnimationKeys.addAll(animationKeys);
    return copyOfAnimationKeys;
}

From source file:edu.dfci.cccb.mev.hcl.domain.simple.SimpleTwoDimensionalHclBuilder.java

private List<Integer> traverse(List<String> keys, Node node) {
    if (node instanceof Leaf) {
        for (int index = keys.size(); --index >= 0;) {
            if (((Leaf) node).name().equals(keys.get(index)))
                return new ArrayList<Integer>(asList(index));
        }//from  w  w  w  . ja  v a 2s  . c om
        throw new IllegalStateException();
    } else {
        ArrayList<Integer> traversal = new ArrayList<Integer>();
        for (Node child : ((Branch) node).children())
            traversal.addAll(traverse(keys, child));
        return traversal;
    }
}

From source file:com.epam.catgenome.manager.protein.ProteinSequenceManager.java

private ArrayList<Gene> removeCdsDuplicates(final Set<Gene> allCdsList,
        final Map<Gene, List<List<Sequence>>> alternativeNucleotides) {
    ArrayList<Gene> variationCds = new ArrayList<>();
    variationCds.addAll(alternativeNucleotides.keySet());
    Set<Gene> helpAllCdsList = allCdsList;
    // Remove duplicates from all cds list.
    for (Gene cds : variationCds) {
        helpAllCdsList = allCdsList.stream()
                .filter(geneFeature -> !geneFeature.getStartIndex().equals(cds.getStartIndex())
                        && !geneFeature.getEndIndex().equals(cds.getEndIndex()))
                .collect(Collectors.toSet());
    }//from  w ww . j a v  a 2s  .c om
    variationCds.addAll(helpAllCdsList);
    return variationCds;
}

From source file:com.moki.touch.util.management.ContentManager.java

/**
 * Get all Urls that exist in the content cache. This may be more than exist in the settings in some cases.
 * @return an arraylist of strings indicating what files exist in the content store
 *///w ww  .j  a va  2s  .  c o m
public ArrayList<String> getAllContentUrls() {
    ArrayList<String> contentUrls = new ArrayList<String>();
    File contentDir = new File(Environment.getExternalStorageDirectory() + CONTENT_LOCATION);
    if (contentDir.list() != null) {
        contentUrls.addAll(Arrays.asList(contentDir.list()));
    }
    return contentUrls;
}

From source file:bammerbom.ultimatecore.bukkit.UltimateCommands.java

@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String label, String[] args) {
    if (Overrider.checkOverridden(sender, cmd, label, args)) {
        return null;
    }//w  w w.  ja  v  a  2  s  .com
    List<String> rtrn = null;
    if (label.startsWith("ultimatecore:")) {
        label = label.replaceFirst("ultimatecore:", "");
    }
    for (UltimateCommand cmdr : cmds) {
        if (cmdr.getName().equals(label) || cmdr.getAliases().contains(label)) {
            try {
                rtrn = cmdr.onTabComplete(sender, cmd, label, args, args[args.length - 1], args.length - 1);
            } catch (Exception ex) {
                ErrorLogger.log(ex, "Failed tabcompleting for " + label);
            }
            break;
        }
    }
    if (rtrn == null) {
        rtrn = new ArrayList<>();
        for (Player p : r.getOnlinePlayers()) {
            rtrn.add(p.getName());
        }
    }
    ArrayList<String> rtrn2 = new ArrayList<>();
    rtrn2.addAll(rtrn);
    rtrn = rtrn2;
    if (!StringUtil.nullOrEmpty(args[args.length - 1])) {
        List<String> remv = new ArrayList<>();
        for (String s : rtrn) {
            if (!StringUtils.startsWithIgnoreCase(s, args[args.length - 1])) {
                remv.add(s);
            }
        }
        rtrn.removeAll(remv);
    }
    return rtrn;
}

From source file:alma.acs.nc.testsupport.InMemorySubscriber.java

protected void resumeAction(EventDispatcher evtDispatcher, ErrorReporter errRep, SCInstance scInstance,
        Collection<TriggerEvent> derivedEvents) throws AcsJStateMachineActionEx {
    super.resumeAction(evtDispatcher, errRep, scInstance, derivedEvents);

    // async re-sending of suspendBuffer data
    final ArrayList<CachedEvent> oldBuffer = new ArrayList<CachedEvent>(suspendBuffer.size());
    synchronized (suspendBuffer) {
        oldBuffer.addAll(suspendBuffer);
        suspendBuffer.clear();//from   w  ww  . ja v  a 2 s.c  o  m
    }
    Runnable processor = new Runnable() {
        @Override
        public void run() {
            try {
                for (CachedEvent cachedEvent : oldBuffer) {
                    // if in the meantime we get suspended again, suspendBuffer will again hold our data.
                    pushData(cachedEvent.eventData, cachedEvent.eventDesc);
                }
            } catch (AcsJIllegalStateEventEx ex) {
                logger.log(Level.WARNING,
                        "Failed to deliver buffered events (suspended time) because subscriber is now disconnected.",
                        ex);
            }
        }
    };
    services.getThreadFactory().newThread(processor).start();
}

From source file:octopus.teamcity.agent.OctopusBuildProcess.java

private void startOcto(final OctopusCommandBuilder command) throws RunBuildException {
    String[] userVisibleCommand = command.buildMaskedCommand();
    String[] realCommand = command.buildCommand();

    logger = runningBuild.getBuildLogger();
    logger.activityStarted("Octopus Deploy", DefaultMessagesInfo.BLOCK_TYPE_INDENTATION);
    logger.message(//  w ww . j a v a2s. c  o m
            "Running command:   octo.exe " + StringUtils.arrayToDelimitedString(userVisibleCommand, " "));
    logger.progressMessage(getLogMessage());

    try {
        Runtime runtime = Runtime.getRuntime();

        String octopusVersion = getSelectedOctopusVersion();

        ArrayList<String> arguments = new ArrayList<String>();
        arguments.add(new File(extractedTo, octopusVersion + "\\octo.exe").getAbsolutePath());
        arguments.addAll(Arrays.asList(realCommand));

        process = runtime.exec(arguments.toArray(new String[arguments.size()]), null,
                context.getWorkingDirectory());

        final LoggingProcessListener listener = new LoggingProcessListener(logger);

        standardError = new OutputReaderThread(process.getErrorStream(), new OutputWriter() {
            public void write(String text) {
                listener.onErrorOutput(text);
            }
        });
        standardOutput = new OutputReaderThread(process.getInputStream(), new OutputWriter() {
            public void write(String text) {
                listener.onStandardOutput(text);
            }
        });

        standardError.start();
        standardOutput.start();
    } catch (IOException e) {
        final String message = "Error from Octo.exe: " + e.getMessage();
        Logger.getInstance(getClass().getName()).error(message, e);
        throw new RunBuildException(message);
    }
}