Example usage for java.util Collection addAll

List of usage examples for java.util Collection addAll

Introduction

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

Prototype

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

Source Link

Document

Adds all of the elements in the specified collection to this collection (optional operation).

Usage

From source file:admin.service.SimpleJobService.java

@Override
public int countJobs() {
    Collection<String> names = new HashSet<String>(jobLocator.getJobNames());
    names.addAll(jobInstanceDao.getJobNames());
    return names.size();
}

From source file:io.cloudslang.lang.compiler.validator.PreCompileValidatorImpl.java

@Override
public List<RuntimeException> validateNoDuplicateInOutParams(List<? extends InOutParam> inputs,
        InOutParam element) {/*ww  w.  jav a  2 s  .  c o m*/
    List<RuntimeException> errors = new ArrayList<>();
    Collection<InOutParam> inOutParams = new ArrayList<>();
    inOutParams.addAll(inputs);

    String message = "Duplicate " + getMessagePart(element.getClass()) + " found: " + element.getName();
    validateNotDuplicateInOutParam(inOutParams, element, message, errors);
    return errors;
}

From source file:edu.umn.msi.tropix.persistence.service.impl.FileServiceImpl.java

private Collection<TropixFile> getFiles(final Iterable<String> ids) {
    final Collection<TropixFile> files = Lists.newLinkedList();
    for (final String id : ids) {
        final TropixObject tropixObject = getTropixObjectDao().loadTropixObject(id);
        final FileTropixObjectVisitorImpl visitor = new FileTropixObjectVisitorImpl();
        TropixObjectVistorUtils.visit(tropixObject, visitor);
        files.addAll(visitor.files);
    }/*from  w  w  w  . ja v a  2s  .  c  o m*/
    return files;
}

From source file:com.romeikat.datamessie.core.base.util.sparsetable.SparseMultiTable.java

@Override
public synchronized Collection<Z> getRowValues(final Y columnHeader) {
    final Collection<Z> collectedRowValues = Lists.newLinkedList();

    final Collection<List<Z>> rowValues = innerTable.getRowValues(columnHeader);
    for (final List<Z> rowValue : rowValues) {
        collectedRowValues.addAll(rowValue);
    }//w w w .  ja v  a 2 s. co m

    return collectedRowValues;
}

From source file:org.walkmod.conf.entities.impl.ConfigurationImpl.java

public Collection<VisitorMessage> getVisitorMessages() {
    Collection<VisitorMessage> result = new LinkedList<VisitorMessage>();
    if (getChainConfigs() != null) {
        for (ChainConfig aqConfig : getChainConfigs()) {
            result.addAll(aqConfig.getWalkerConfig().getWalker().getVisitorMessages());
        }//from www.  j av a2  s .  c o m
    }
    return result;
}

From source file:com.isomorphic.maven.mojo.AbstractPackagerMojo.java

/**
 * Provides some initialization and validation steps around the collection and transformation of an Isomorphic SDK. 
 * /*from w  w  w. j a  v  a  2s.  com*/
 * @throws MojoExecutionException When any fatal error occurs.
 * @throws MojoFailureException When any non-fatal error occurs. 
 */
public void execute() throws MojoExecutionException, MojoFailureException {

    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    dateFormat.setLenient(false);
    if (buildDate == null) {
        buildDate = dateFormat.format(new Date());
    }
    try {
        dateFormat.parse(buildDate);
    } catch (ParseException e) {
        throw new MojoExecutionException(
                String.format("buildDate '%s' must take the form yyyy-MM-dd.", buildDate));
    }

    LOGGER.debug("buildDate set to '{}'", buildDate);

    String buildNumberFormat = "\\d.*\\.\\d.*[d|p]";
    if (!buildNumber.matches(buildNumberFormat)) {
        throw new MojoExecutionException(
                String.format("buildNumber '%s' must take the form [major].[minor].[d|p].  e.g., 4.1d",
                        buildNumber, buildNumberFormat));
    }

    File basedir = FileUtils.getFile(workdir, product.toString(), license.toString(), buildNumber, buildDate);

    //add optional modules to the list of downloads
    List<License> licenses = new ArrayList<License>();
    licenses.add(license);
    if (license == POWER || license == ENTERPRISE) {
        if (includeAnalytics) {
            licenses.add(ANALYTICS_MODULE);
        }
        if (includeMessaging) {
            licenses.add(MESSAGING_MODULE);
        }
    }

    //collect the maven artifacts and send them along to the abstract method
    Set<Module> artifacts = collect(licenses, basedir);

    File bookmarkable = new File(basedir.getParent(), "latest");
    LOGGER.info("Copying distribution to '{}'", bookmarkable.getAbsolutePath());
    try {
        FileUtils.forceMkdir(bookmarkable);
        FileUtils.cleanDirectory(bookmarkable);
        FileUtils.copyDirectory(basedir, bookmarkable,
                FileFilterUtils.notFileFilter(FileFilterUtils.nameFileFilter("zip")));
    } catch (IOException e) {
        throw new MojoFailureException("Unable to copy distribution contents", e);
    }

    String[] executables = { "bat", "sh", "command" };
    Collection<File> scripts = FileUtils.listFiles(basedir, executables, true);
    scripts.addAll(FileUtils.listFiles(bookmarkable, executables, true));
    for (File script : scripts) {
        script.setExecutable(true);
        LOGGER.debug("Enabled execute permissions on file '{}'", script.getAbsolutePath());
    }
    doExecute(artifacts);

}

From source file:graph.module.OntologyEdgeModule.java

/**
 * Gets all edges but the one given by the key.
 * //  w  w w .  j  a v a  2  s .co  m
 * @param node
 *            The edges must include this node.
 * @param butEdgeKey
 *            The key that is NOT added to the results.
 * @return A collection of edges that are indexed by node, but none from the
 *         butEdgeKey (though they may be added if included under other
 *         keys).
 */
public Collection<Edge> getAllButEdges(Node node, Object butEdgeKey) {
    MultiMap<Object, Edge> indexedEdges = relatedEdges_.get(node);
    if (indexedEdges == null) {
        return new ConcurrentLinkedQueue<>();
    }

    Collection<Edge> edges = new HashSet<>();
    for (Object key : indexedEdges.keySet()) {
        if (!key.equals(butEdgeKey)) {
            // Need to check same function level as butEdge
            if (StringUtils.countMatches((String) key, FUNC_SPLIT) == StringUtils
                    .countMatches((String) butEdgeKey, FUNC_SPLIT))
                edges.addAll(indexedEdges.get(key));
        }
    }
    return edges;
}

From source file:com.jaeksoft.searchlib.crawler.web.browser.BrowserDriver.java

final public int locateBy(By by, Collection<WebElement> elements, boolean faultTolerant)
        throws SearchLibException {
    try {// ww w  .j  a  va  2  s . c om
        List<WebElement> list = driver.findElements(by);
        if (list == null)
            return 0;
        elements.addAll(list);
        return list.size();
    } catch (Exception e) {
        if (!faultTolerant)
            throw new SearchLibException("Web element location failed: " + by);
        Logging.warn(e);
        return 0;
    }
}

From source file:com.romeikat.datamessie.core.base.util.sparsetable.SparseMultiTable.java

@Override
public synchronized Collection<Z> getColumnValues(final X rowHeader) {
    final Collection<Z> collectedColumnValues = Lists.newLinkedList();

    final Collection<List<Z>> columnValues = innerTable.getColumnValues(rowHeader);
    for (final List<Z> columnValue : columnValues) {
        collectedColumnValues.addAll(columnValue);
    }//from   w  w  w.  j ava2 s .  c om

    return collectedColumnValues;
}

From source file:de.skuzzle.polly.http.internal.HttpServerImpl.java

@Override
public Collection<HttpSession> getSessions() {
    final Collection<HttpSession> result = new ArrayList<>();
    switch (this.getSessionType()) {
    case SESSION_TYPE_COOKIE:
    case SESSION_TYPE_GET:
        synchronized (this.idToSession) {
            result.addAll(this.idToSession.values());
        }/*ww  w .  java  2 s . c om*/
        break;
    case SESSION_TYPE_IP:
        synchronized (this.ipToSession) {
            result.addAll(this.ipToSession.values());
        }
    }
    return Collections.unmodifiableCollection(result);
}