Example usage for com.google.common.collect ImmutableSet.Builder addAll

List of usage examples for com.google.common.collect ImmutableSet.Builder addAll

Introduction

In this page you can find the example usage for com.google.common.collect ImmutableSet.Builder addAll.

Prototype

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

Source Link

Document

Adds all of the elements in the specified collection to this set if they're not already present (optional operation).

Usage

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

public ImmutableSet<CxxInferCapture> getAllTransitiveCaptures() {
    ImmutableSet.Builder<CxxInferCapture> captureBuilder = ImmutableSet.builder();
    captureBuilder.addAll(captureAndTransitiveAggregatingRules.captureRules);
    for (CxxInferCaptureRulesAggregator aggregator : captureAndTransitiveAggregatingRules.aggregatingRules) {
        captureBuilder.addAll(aggregator.getCaptureRules());
    }//from  w  w  w.  ja va 2 s  .c om
    return captureBuilder.build();
}

From source file:com.google.devtools.build.lib.analysis.CompositeRunfilesSupplier.java

@Override
public Iterable<Artifact> getArtifacts() {
    ImmutableSet.Builder<Artifact> result = ImmutableSet.builder();
    result.addAll(first.getArtifacts());
    result.addAll(second.getArtifacts());
    return result.build();
}

From source file:es.udc.pfc.gamelib.chess.pieces.ChessQueen.java

@Override
public final ImmutableSet<Position> getStandardMoves(final ChessBoard board) {
    final ImmutableSet.Builder<Position> moves = ImmutableSet.builder();

    moves.addAll(getMovesTo(board, Direction.N));
    moves.addAll(getMovesTo(board, Direction.S));
    moves.addAll(getMovesTo(board, Direction.E));
    moves.addAll(getMovesTo(board, Direction.W));
    moves.addAll(getMovesTo(board, Direction.NE));
    moves.addAll(getMovesTo(board, Direction.NW));
    moves.addAll(getMovesTo(board, Direction.SE));
    moves.addAll(getMovesTo(board, Direction.SW));

    return moves.build();
}

From source file:com.google.devtools.build.lib.analysis.CompositeRunfilesSupplier.java

@Override
public ImmutableSet<PathFragment> getRunfilesDirs() {
    ImmutableSet.Builder<PathFragment> result = ImmutableSet.builder();
    result.addAll(first.getRunfilesDirs());
    result.addAll(second.getRunfilesDirs());
    return result.build();
}

From source file:com.spotify.heroic.aggregation.Group.java

@Override
public GroupInstance apply(final AggregationContext context) {
    final AggregationInstance instance = each.flatMap(AggregationOrList::toAggregation).orElse(Empty.INSTANCE)
            .apply(context);/* www . jav  a 2  s.c  om*/

    final Optional<List<String>> of = this.of.map(o -> {
        final ImmutableSet.Builder<String> b = ImmutableSet.builder();
        b.addAll(o).addAll(context.requiredTags());
        return ImmutableList.copyOf(b.build());
    });

    return new GroupInstance(of, instance);
}

From source file:org.apache.shindig.social.sample.SampleModule.java

@Override
protected Set<Object> getHandlers() {
    ImmutableSet.Builder<Object> handlers = ImmutableSet.builder();
    handlers.addAll(super.getHandlers());
    handlers.add(SampleContainerHandler.class);
    return handlers.build();
}

From source file:org.androidtransfuse.transaction.TransactionProcessorChain.java

@Override
public ImmutableSet<Exception> getErrors() {
    ImmutableSet.Builder<Exception> exceptions = ImmutableSet.builder();
    exceptions.addAll(beforeProcessor.getErrors());
    exceptions.addAll(afterProcessor.getErrors());

    return exceptions.build();
}

From source file:org.janusgraph.diskstorage.configuration.MergedConfiguration.java

@Override
public Set<String> getContainedNamespaces(ConfigNamespace umbrella, String... umbrellaElements) {
    ImmutableSet.Builder<String> b = ImmutableSet.builder();
    b.addAll(first.getContainedNamespaces(umbrella, umbrellaElements));
    b.addAll(second.getContainedNamespaces(umbrella, umbrellaElements));
    return b.build();
}

From source file:es.udc.pfc.gamelib.chess.pieces.ChessBishop.java

@Override
public ImmutableSet<Position> getStandardMoves(final ChessBoard board) {
    final ImmutableSet.Builder<Position> moves = ImmutableSet.builder();

    moves.addAll(getMovesTo(board, Direction.NE));
    moves.addAll(getMovesTo(board, Direction.NW));
    moves.addAll(getMovesTo(board, Direction.SE));
    moves.addAll(getMovesTo(board, Direction.SW));

    return moves.build();
}

From source file:org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor.java

/**
 * Get the events table for an experiment. If all traces in the experiment
 * are of the same type, use the same behavior as if it was one trace of
 * that type./*from  w  w  w.j  a va2s  . c om*/
 *
 * @param experiment
 *            the experiment
 * @param parent
 *            the parent Composite
 * @param cacheSize
 *            the event table cache size
 * @return An event table of the appropriate type
 */
private static @NonNull Iterable<ITmfEventAspect<?>> getExperimentAspects(final TmfExperiment experiment) {
    List<ITmfTrace> traces = experiment.getTraces();
    ImmutableSet.Builder<ITmfEventAspect<?>> builder = new ImmutableSet.Builder<>();

    /* For experiments, we'll add a "trace name" aspect/column */
    builder.add(TmfBaseAspects.getTraceNameAspect());

    String commonTraceType = getCommonTraceType(experiment);
    if (commonTraceType != null) {
        /*
         * All the traces in this experiment are of the same type, let's
         * just use the normal table for that type.
         */
        builder.addAll(traces.get(0).getEventAspects());

    } else {
        /*
         * There are different trace types in the experiment, so we are
         * definitely using a TmfEventsTable. Aggregate the columns from all
         * trace types.
         */
        for (ITmfTrace trace : traces) {
            Iterable<ITmfEventAspect<?>> traceAspects = trace.getEventAspects();
            builder.addAll(traceAspects);
        }
    }
    return builder.build();
}