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:com.facebook.buck.core.model.targetgraph.impl.TargetGraphAndTargets.java

public static TargetGraphAndTargets create(ImmutableSet<BuildTarget> graphRoots, TargetGraph projectGraph,
        boolean isWithTests, ImmutableSet<BuildTarget> explicitTests) {
    // Get the roots of the main graph. This contains all the targets in the project slice, or all
    // the valid project roots if a project slice is not specified.
    Iterable<TargetNode<?>> projectRoots = projectGraph.getAll(graphRoots);

    // Optionally get the roots of the test graph. This contains all the tests that cover the roots
    // of the main graph or their dependencies.
    Iterable<TargetNode<?>> associatedTests = ImmutableSet.of();
    if (isWithTests) {
        associatedTests = projectGraph.getAll(explicitTests);
    }//from   w w  w .j av  a2 s  .c o  m

    TargetGraph targetGraph = projectGraph.getSubgraph(Iterables.concat(projectRoots, associatedTests));

    return new TargetGraphAndTargets(targetGraph, projectRoots);
}

From source file:org.eclipse.xtext.resource.containers.DescriptionAddingContainer.java

@Override
public Iterable<IResourceDescription> getResourceDescriptions() {
    return Iterables.concat(Collections.singleton(description), delegate.getResourceDescriptions());
}

From source file:org.apache.drill.exec.server.options.FragmentOptionsManager.java

@Override
public Iterator<OptionValue> iterator() {
    return Iterables.concat(systemOptions, options.values()).iterator();
}

From source file:org.eclipse.emf.compare.internal.spec.ComparisonSpec.java

/**
 * {@inheritDoc}//from w  w w. java 2 s . co m
 * 
 * @see org.eclipse.emf.compare.impl.ComparisonImpl#getDifferences()
 */
@Override
public EList<Diff> getDifferences() {
    Iterable<Diff> diffIterable = Lists.newArrayList();

    final List<Match> mappings = getMatches();
    for (int i = 0; i < mappings.size(); i++) {
        diffIterable = Iterables.concat(diffIterable, getDifferences(mappings.get(i)));
    }

    final EList<Diff> allDifferences = new BasicEList<Diff>();
    for (Diff diff : diffIterable) {
        ((AbstractEList<Diff>) allDifferences).addUnique(diff);
    }

    return allDifferences;
}

From source file:org.eclipse.xtext.graphview.behavior.visibility.RevealButton.java

protected boolean hasHiddenEdge() {
    AbstractInstance model = getHost().getModel();
    if (model instanceof NodeInstance) {
        NodeInstance node = (NodeInstance) model;
        return Iterables.any(Iterables.concat(node.getOutgoingEdges(), node.getIncomingEdges()),
                new Predicate<EdgeInstance>() {
                    public boolean apply(EdgeInstance input) {
                        return input.getVisibility() == Visibility.HIDDEN;
                    }//from w  w w .ja v a2  s .  c  o  m
                });
    } else {
        return false;
    }
}

From source file:org.trancecode.collection.TcIterables.java

public static <T> Iterable<T> append(final Iterable<T> iterable, final T... elements) {
    return Iterables.concat(iterable, ImmutableList.copyOf(elements));
}

From source file:org.s23m.cell.communication.xml.model.schemainstance.SemanticDomainNode.java

@Override
protected Iterable<? extends Node> getAdditionalChildren() {
    Iterable<? extends Node> currentChildren = super.getAdditionalChildren();
    return Iterables.concat(currentChildren, identityList);
}

From source file:org.kurento.tree.server.kms.Pipeline.java

public Iterable<Element> getElements() {

    checkReleased();

    return Iterables.concat(webRtcs, plumbers);
}

From source file:org.jnario.feature.feature.impl.ScenarioImplCustom.java

@Override
public EList<Step> getPendingSteps() {
    if (pendingSteps == null) {
        pendingSteps = new BasicEList<Step>();
        Feature feature = EcoreUtil2.getContainerOfType(this, Feature.class);
        Background background = feature.getBackground();
        boolean pendingSeen = false;
        Iterable<Step> allSteps;
        if (background == null) {
            allSteps = getSteps();/*ww  w.  j  a va 2 s .c  o m*/
        } else {
            allSteps = Iterables.concat(background.getSteps(), getSteps());
        }
        for (Step step : allSteps) {
            if (pendingSeen || step.isPending()) {
                pendingSeen = true;
                pendingSteps.add(step);
            }
        }
    }
    return pendingSteps;
}

From source file:com.codebullets.sagalib.processing.ClassTypeExtractor.java

/**
 * Gets a combined list of super classes and interfaces. The super classes
 * are always returned first./*w w  w . j  ava  2s.com*/
 */
public Iterable<Class<?>> allClassesAndInterfaces() {
    return Iterables.concat(allClasses(), interfaces());
}