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.presto.raptor.storage.organization.CompactionSetCreator.java

public Set<OrganizationSet> createCompactionSets(Table tableInfo, Collection<ShardIndexInfo> shards) {
    Collection<Collection<ShardIndexInfo>> shardsByDaysBuckets = getShardsByDaysBuckets(tableInfo, shards);

    ImmutableSet.Builder<OrganizationSet> compactionSets = ImmutableSet.builder();
    for (Collection<ShardIndexInfo> shardInfos : shardsByDaysBuckets) {
        compactionSets.addAll(buildCompactionSets(tableInfo, ImmutableSet.copyOf(shardInfos)));
    }//from  ww  w . j a  v  a  2 s .com
    return compactionSets.build();
}

From source file:com.spectralogic.ds3autogen.java.generators.responseparser.BaseResponseParserGenerator.java

/**
 * Retrieves the java imports needed to generate the response parser
 *//*w  ww  .  j  ava  2s .  c  o m*/
@Override
public ImmutableSet<String> toImportList(final String responseName, final Ds3Request ds3Request,
        final ImmutableList<Ds3ResponseCode> responseCodes) {
    final ImmutableSet.Builder<String> builder = ImmutableSet.builder();

    builder.addAll(getImportListFromResponseCodes(responseCodes));
    //If a response type has an associated import, then the XmlOutput import is also needed
    if (builder.build().size() > 0) {
        builder.add("com.spectralogic.ds3client.serializer.XmlOutput");
        builder.add("java.io.InputStream");
    }
    if (builder.build().contains("java.lang.String") || builder.build().contains("String")) {
        builder.add("java.nio.charset.StandardCharsets");
        builder.add("org.apache.commons.io.IOUtils");
    }

    builder.add("com.spectralogic.ds3client.commands.parsers.utils.ResponseParserUtils");
    builder.addAll(requiredImportList());
    builder.add(getParentClassImport());
    builder.add(getCommandPackage(ds3Request) + "." + responseName);

    //Sort imports alphabetically for generated code aesthetics
    return builder.build().stream().sorted().collect(GuavaCollectors.immutableSet());
}

From source file:org.gradle.model.internal.manage.schema.AbstractStructSchema.java

@Override
public Set<WeaklyTypeReferencingMethod<?, ?>> getAllMethods() {
    ImmutableSet.Builder<WeaklyTypeReferencingMethod<?, ?>> builder = ImmutableSet.builder();
    for (ModelProperty<?> property : properties.values()) {
        builder.addAll(property.getAccessors());
    }//  ww w .j  a v  a  2 s.c  o m
    builder.addAll(nonPropertyMethods);
    return builder.build();
}

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

public TargetGroup withReplacedTargets(Map<BuildTarget, Iterable<BuildTarget>> replacements) {
    ImmutableSet.Builder<BuildTarget> newTargets = ImmutableSet.builder();
    for (BuildTarget existingTarget : targets) {
        if (replacements.containsKey(existingTarget)) {
            newTargets.addAll(replacements.get(existingTarget));
        } else {/*from   www .ja v  a  2s  . c o  m*/
            newTargets.add(existingTarget);
        }
    }
    return new TargetGroup(newTargets.build(), Optional.of(restrictOutboundVisibility), buildTarget);
}

From source file:io.prestosql.plugin.raptor.legacy.storage.organization.CompactionSetCreator.java

public Set<OrganizationSet> createCompactionSets(Table tableInfo, Collection<ShardIndexInfo> shards) {
    Collection<Collection<ShardIndexInfo>> shardsByDaysBuckets = getShardsByDaysBuckets(tableInfo, shards,
            temporalFunction);//from   w  w w  .j  ava  2s .  co m

    ImmutableSet.Builder<OrganizationSet> compactionSets = ImmutableSet.builder();
    for (Collection<ShardIndexInfo> shardInfos : shardsByDaysBuckets) {
        compactionSets.addAll(buildCompactionSets(tableInfo, ImmutableSet.copyOf(shardInfos)));
    }
    return compactionSets.build();
}

From source file:com.facebook.buck.ide.intellij.BaseIjModuleRule.java

private ImmutableSet<Path> findConfiguredGeneratedSourcePaths(TargetNode<T, ?> targetNode) {
    ImmutableSet.Builder<Path> generatedSourcePaths = ImmutableSet.builder();

    generatedSourcePaths.addAll(findConfiguredGeneratedSourcePathsUsingDeps(targetNode));
    generatedSourcePaths.addAll(findConfiguredGeneratedSourcePathsUsingLabels(targetNode));

    return generatedSourcePaths.build();
}

From source file:org.projectbuendia.client.diagnostics.Troubleshooter.java

private void postTroubleshootingEvents() {
    synchronized (mTroubleshootingLock) {
        ImmutableSet.Builder<TroubleshootingAction> actionsBuilder = ImmutableSet.builder();

        actionsBuilder.addAll(getNetworkConnectivityTroubleshootingActions());
        actionsBuilder.addAll(getConfigurationTroubleshootingActions());
        actionsBuilder.addAll(getUpdateServerTroubleshootingActions());

        ImmutableSet<TroubleshootingAction> actions = actionsBuilder.build();

        if (mLastTroubleshootingActionsChangedEvent != null) {
            // If nothing's changed since the last time we checked, don't post a new event.
            if (mLastTroubleshootingActionsChangedEvent.actions.equals(actions)) {
                return;
            }/*from w w  w . j  av  a 2  s.c  o m*/

            mEventBus.removeStickyEvent(mLastTroubleshootingActionsChangedEvent);
        }

        mLastTroubleshootingActionsChangedEvent = new TroubleshootingActionsChangedEvent(actions);
        mEventBus.postSticky(mLastTroubleshootingActionsChangedEvent);
    }
}

From source file:org.androidtransfuse.analysis.astAnalyzer.AnnotationValidationAnalysis.java

private ImmutableSet<ASTAnnotation> flatten(ImmutableSet<ASTAnnotation>... sets) {
    ImmutableSet.Builder<ASTAnnotation> combineBuilder = ImmutableSet.builder();
    for (ImmutableSet<ASTAnnotation> set : sets) {
        combineBuilder.addAll(set);
    }// w  ww. j a  v a 2 s  .c o m
    return combineBuilder.build();
}

From source file:org.sosy_lab.cpachecker.core.algorithm.termination.lasso_analysis.RankingRelation.java

/**
 * Create a new {@link RankingRelation} that is the disjunction of this and <code>other</code>
 * @param other the {@link RankingRelation} to merge with
 * @return a new {@link RankingRelation}
 *///from w w  w .  j  av a  2s. com
@CheckReturnValue
public RankingRelation merge(RankingRelation other) {
    ImmutableSet.Builder<CExpression> newRankingRelations = ImmutableSet.builder();
    newRankingRelations.addAll(rankingRelations);
    newRankingRelations.addAll(other.rankingRelations);

    ImmutableSet.Builder<BooleanFormula> newRankingRelationFormulas = ImmutableSet.builder();
    newRankingRelationFormulas.addAll(rankingRelationFormulas);
    newRankingRelationFormulas.addAll(other.rankingRelationFormulas);

    ImmutableSet.Builder<BooleanFormula> newSupportingInvariants = ImmutableSet.builder();
    newSupportingInvariants.addAll(supportingInvariants);
    newSupportingInvariants.addAll(other.supportingInvariants);

    return new RankingRelation(newRankingRelations.build(), newRankingRelationFormulas.build(),
            newSupportingInvariants.build(), binaryExpressionBuilder, formulaManagerView);
}

From source file:org.jboss.weld.event.EventPacket.java

@Override
public Set<Annotation> getQualifiers() {
    ImmutableSet.Builder<Annotation> builder = ImmutableSet.<Annotation>builder();
    builder.add(AnyLiteral.INSTANCE);/* w w  w  .  j  a va  2  s.c om*/
    if (qualifierSet != null) {
        return builder.addAll(qualifierSet).build();
    } else if (qualifierArray != null) {
        return builder.add(qualifierArray).build();
    } else {
        throw new IllegalStateException();
    }
}