Example usage for com.google.common.collect Iterables concat

List of usage examples for com.google.common.collect Iterables concat

Introduction

In this page you can find the example usage for com.google.common.collect Iterables concat.

Prototype

public static <T> Iterable<T> concat(Iterable<? extends T> a, Iterable<? extends T> b) 

Source Link

Document

Combines two iterables into a single iterable.

Usage

From source file:org.sonar.java.model.statement.StaticInitializerTreeImpl.java

@Override
public Iterable<Tree> children() {
    return Iterables.concat(Collections.singletonList(staticKeyword), super.children());
}

From source file:org.apache.james.JmapJamesServer.java

public JmapJamesServer combineWith(Module... modules) {
    return new JmapJamesServer(
            Modules.combine(Iterables.concat(Arrays.asList(module), Arrays.asList(modules))));
}

From source file:com.facebook.buck.cxx.CxxToolFlags.java

/**
 * Concatenate multiple flags in a pairwise manner.
 *//*from w ww  .  j  a  v  a 2s  . c o  m*/
public static CxxToolFlags concat(CxxToolFlags... parts) {
    Iterable<String> platformFlags = ImmutableList.of();
    Iterable<String> ruleFlags = ImmutableList.of();
    for (CxxToolFlags part : parts) {
        platformFlags = Iterables.concat(platformFlags, part.getPlatformFlags());
        ruleFlags = Iterables.concat(ruleFlags, part.getRuleFlags());
    }
    return IterableCxxToolFlags.of(platformFlags, ruleFlags);
}

From source file:org.eclipse.sirius.diagram.business.internal.sync.visitor.DefaultDiagramElementsHierarchyVisitor.java

/**
 * {@inheritDoc}/*from  w  ww  .j a  v a 2s .c om*/
 * 
 * @see org.eclipse.sirius.diagram.business.internal.sync.visitor.DiagramElementsHierarchyVisitor#getChildren(org.eclipse.emf.ecore.EObject)
 */
public Iterable<? extends DDiagramElement> getChildren(final DragAndDropTarget element) {

    Iterable<? extends DDiagramElement> children;

    if (element instanceof DDiagram) {
        children = Iterables.concat(((DDiagram) element).getOwnedDiagramElements(),
                ((DDiagram) element).getEdges());

    } else if (element instanceof DNodeContainer) {
        children = Iterables.concat(((DNodeContainer) element).getOwnedDiagramElements(),
                ((DNodeContainer) element).getOwnedBorderedNodes());

    } else if (element instanceof DNodeList) {
        children = Iterables.concat(((DNodeList) element).getElements(),
                ((DNodeList) element).getOwnedBorderedNodes());

    } else if (element instanceof DNode) {
        children = ((DNode) element).getOwnedBorderedNodes();
    } else {
        children = Collections.emptySet();
    }
    return children;
}

From source file:co.cask.common.cli.CommandSet.java

/**
 * @return {@link Iterator} over the {@link #commands} and the {@link Command}s within the {@link #commandSets}
 */// w  w  w . j  a v a 2 s .  c  o m
public Iterator<T> iterator() {
    return Iterables.concat(commands, Iterables.concat(commandSets)).iterator();
}

From source file:com.torodb.integration.mongo.v3m0.jstests.CoreIT.java

private static ScriptClassifier createScriptClassifier() {
    Set<Script> workingSet = getWorkingSet(), noArraysWorkingSet = getNoArraysWorkingSet(),
            greenplumWorkingSet = getGreenplumWorkingSet(), catastrophicSet = getCatastrophicSet(),
            greenplumCatastrophicSet = Sets
                    .newLinkedHashSet(Iterables.concat(getCatastrophicSet(), getGreenplumCatastrophicSet())),
            falsePositiveSet = getFalsePositiveSet(), notImplementedSet = getNotImplementedSet(),
            noArraysNotImplemented = getNoArraysNotImplementedSet(), ignoredSet = getIgnoredSet(),
            allSet = Sets.newLinkedHashSet(Iterables.concat(workingSet, catastrophicSet, falsePositiveSet,
                    notImplementedSet, ignoredSet));
    return new Builder().addScripts(Mongo, Postgres, WORKING, workingSet)
            .addScripts(Mongo, Postgres, NOT_IMPLEMENTED, notImplementedSet)
            .addScripts(Mongo, Postgres, FALSE_POSITIVE, falsePositiveSet)
            .addScripts(Mongo, Postgres, CATASTROPHIC, catastrophicSet)
            .addScripts(Mongo, Postgres, IGNORED, ignoredSet)

            .addScripts(Mongo, MySQL, WORKING, noArraysWorkingSet)
            .addScripts(Mongo, MySQL, NOT_IMPLEMENTED, noArraysNotImplemented)
            .addScripts(Mongo, MySQL, FALSE_POSITIVE, falsePositiveSet)
            .addScripts(Mongo, MySQL, CATASTROPHIC, catastrophicSet)
            .addScripts(Mongo, MySQL, IGNORED, ignoredSet)

            .addScripts(Mongo, Greenplum, WORKING, greenplumWorkingSet)
            .addScripts(Mongo, Greenplum, NOT_IMPLEMENTED, noArraysNotImplemented)
            .addScripts(Mongo, Greenplum, FALSE_POSITIVE, falsePositiveSet)
            .addScripts(Mongo, Greenplum, CATASTROPHIC, greenplumCatastrophicSet)
            .addScripts(Mongo, Greenplum, IGNORED, ignoredSet)

            .addScripts(MongoReplSet, Postgres, CATASTROPHIC, allSet)
            .addScripts(MongoReplSet, Greenplum, CATASTROPHIC, allSet)
            .addScripts(MongoReplSet, MySQL, CATASTROPHIC, allSet)

            .build();//from   ww w.ja v a 2s  .  c o  m
}

From source file:org.embulk.guice.Bootstrap.java

public Bootstrap addModules(Iterable<? extends Module> additionalModules) {
    modules = ImmutableList.copyOf(Iterables.concat(modules, additionalModules));
    return this;
}

From source file:com.facebook.buck.cxx.CxxToolFlags.java

/**
 * Returns all flags in the appropriate order.
 *//*from  www  .jav  a2  s  .c  o  m*/
public final Iterable<String> getAllFlags() {
    return Iterables.concat(getPlatformFlags(), getRuleFlags());
}

From source file:clocker.docker.location.strategy.basic.BreadthFirstPlacementStrategy.java

@Override
public List<DockerHostLocation> filterLocations(List<DockerHostLocation> locations, Entity context) {
    if (locations == null || locations.isEmpty()) {
        return ImmutableList.of();
    }/*from w  ww .j a  va 2  s .  c  o m*/

    int size = Iterables.size(locations);
    int next = counter.incrementAndGet() % size;
    if (LOG.isDebugEnabled()) {
        LOG.debug("Breadth first strategy using {} of {}", next, size);
    }

    return ImmutableList
            .copyOf(Iterables.concat(Iterables.skip(locations, next), Iterables.limit(locations, next)));
}

From source file:io.joynr.generator.loading.FolderUriProvider.java

private Iterable<URI> getFilenamesOfFolder(final File myFolder) {
    Iterable<URI> result = getFilesUris(myFolder);

    // subfolder/*w  ww  .  ja v  a2 s.co m*/
    for (File subfolder : getSubfolders(myFolder)) {
        result = Iterables.concat(getFilenamesOfFolder(subfolder), result);
    }
    return result;
}