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.onebusaway.nyc.vehicle_tracking.impl.inference.Observation.java

public Observation(long timestamp, NycRawLocationRecord record, String lastValidDestinationSignCode,
        boolean atBase, boolean atTerminal, boolean outOfService, boolean hasValidDsc,
        Observation previousObservation, Set<AgencyAndId> dscImpliedRoutes, RunResults runResults) {
    _timestamp = timestamp;//from w  w  w .  j  a  va  2  s. co  m
    _record = record;
    _point = ProjectedPointFactory.forward(record.getLatitude(), record.getLongitude());
    _lastValidDestinationSignCode = lastValidDestinationSignCode;
    _dscImpliedRouteCollections = dscImpliedRoutes;
    _runResults = runResults;
    _impliedRouteCollections = Sets.newHashSet(Iterables.concat(dscImpliedRoutes, runResults.getRouteIds()));
    this.atBase = atBase;
    this.atTerminal = atTerminal;
    this.outOfService = outOfService;
    this._hasValidDsc = hasValidDsc;

    if (previousObservation == null) {
        this._timeDelta = null;
        this._distanceMoved = 0d;
        this._orientation = Double.NaN;
    } else {
        this._timeDelta = (timestamp - previousObservation.getTime()) / 1000d;
        this._distanceMoved = TurboButton.distance(previousObservation.getLocation(),
                _point.toCoordinatePoint());
        if (_distanceMoved == 0d) {
            this._orientation = previousObservation.getOrientation();
        } else {
            this._orientation = SphericalGeometryLibrary.getOrientation(
                    previousObservation.getLocation().getLat(), previousObservation.getLocation().getLon(),
                    record.getLatitude(), record.getLongitude());
        }
    }

    _previousObservation = previousObservation;
}

From source file:dagger2.internal.codegen.writer.ConstructorWriter.java

@Override
public Set<ClassName> referencedClasses() {
    return FluentIterable.from(Iterables.concat(parameterWriters.values(), ImmutableList.of(blockWriter)))
            .transformAndConcat(new Function<HasClassReferences, Set<ClassName>>() {
                @Override//w ww  .j  ava  2 s .  c o m
                public Set<ClassName> apply(HasClassReferences input) {
                    return input.referencedClasses();
                }
            }).toSet();
}

From source file:org.polarsys.reqcycle.utils.collect.IterableFactory.java

/**
 * Creates a depth wise iterable that concats all the iterables created by the call of createIterable on each of the starting elements.
 *//*from  ww w.j  a  v a 2  s. c  om*/
public static <T> Iterable<T> createIterable(Iterable<T> startingElements, Picker<T>... pickers) {
    Iterable<T> result = Collections.emptyList();
    for (T t : startingElements) {
        Iterable<T> tIterable = createIterable(t, pickers);
        result = Iterables.concat(result, tIterable);
    }
    return result;
}

From source file:org.richfaces.cdk.templatecompiler.statements.SwitchStatement.java

@Override
public Iterable<HelperMethod> getRequiredMethods() {
    return Iterables.concat(super.getRequiredMethods(), statement.getRequiredMethods());
}

From source file:org.tearsinrain.fasttuple.generate.Config.java

public String packageName(Iterable<String> packagePrefix) {
    return Joiner.on('.').join(Iterables.concat(packagePrefix, packagePath()));
}

From source file:de.metas.ui.web.menu.MenuNode.java

private MenuNode(final Builder builder) {
    super();//from ww  w.j a v a 2 s.co m

    id = builder.getId();
    adMenuId = builder.getAD_Menu_ID();

    caption = builder.caption;
    captionBreadcrumb = builder.captionBreadcrumb;
    type = builder.type;
    elementId = builder.elementId;
    mainTableName = builder.mainTableName;

    children = ImmutableList.copyOf(Iterables.concat(builder.childrenFirst, builder.childrenRest));
    for (final MenuNode child : children) {
        child.parent = this;
    }

    matchedByFilter = false;

    // Validate
    if (type != MenuNodeType.Group && !children.isEmpty()) {
        throw new IllegalArgumentException("Only grouping nodes can have children");
    }
}

From source file:com.facebook.buck.rules.TargetGraphAndTargets.java

public static TargetGraphAndTargets create(final ImmutableSet<BuildTarget> graphRoots, TargetGraph projectGraph,
        AssociatedTargetNodePredicate associatedProjectPredicate, 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.
    ImmutableSet<TargetNode<?, ?>> associatedTests = ImmutableSet.of();
    if (isWithTests) {
        associatedTests = ImmutableSet.copyOf(ImmutableSet.copyOf(projectGraph.getAll(explicitTests)));
    }/*from   ww w  .jav  a  2s . c  o m*/

    ImmutableSet<TargetNode<?, ?>> associatedProjects = getAssociatedTargetNodes(projectGraph,
            Iterables.concat(projectRoots, associatedTests), associatedProjectPredicate);

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

    return new TargetGraphAndTargets(targetGraph, projectRoots);
}

From source file:com.metamx.common.guava.FunctionalIterable.java

public FunctionalIterable<T> concat(Iterable<T>... toConcat) {
    if (toConcat.length == 1) {
        return new FunctionalIterable<>(Iterables.concat(delegate, toConcat[0]));
    }/*from ww  w .jav  a2 s  .  c om*/
    return new FunctionalIterable<>(Iterables.concat(delegate, Iterables.concat(toConcat)));
}

From source file:org.eclipse.viatra.query.patternlanguage.emf.util.PatternParsingResults.java

public Iterable<Issue> getAllDiagnostics() {
    return Iterables.concat(diag.getAllErrors(), diag.getAllWarnings());
}

From source file:com.cloudera.science.ml.core.vectors.Centers.java

/**
 * Construct a new {@code Centers} object made up of the given points
 * and the points contained in this instance.
 * //w w w  .  j  a va2  s.  c o m
 * @param points The new points
 * @return A new {@code Centers} instance
 */
public Centers extendWith(Iterable<Vector> points) {
    return new Centers(Iterables.concat(centers, points));
}