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

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

Introduction

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

Prototype

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

Source Link

Document

Appends all of the elements in the specified collection to the end of this list, in the order that they are returned by the specified collection's iterator (optional operation).

Usage

From source file:eu.eubrazilcc.lvl.service.io.filter.IdentifierFilter.java

public void setIds(final Iterable<String> ids) {
    final ImmutableList.Builder<String> builder = new ImmutableList.Builder<String>();
    this.ids = (ids != null ? builder.addAll(ids).build() : builder.build());
}

From source file:com.linecorp.armeria.client.endpoint.DynamicEndpointGroup.java

/**
 * Adds the specified {@link Endpoint} to current {@link Endpoint} list.
 *//*from   w w  w .  j ava2s.  co m*/
protected final void addEndpoint(Endpoint e) {
    endpointsLock.lock();
    try {
        ImmutableList.Builder<Endpoint> newEndpointsBuilder = ImmutableList.builder();
        newEndpointsBuilder.addAll(endpoints);
        newEndpointsBuilder.add(e);
        endpoints = newEndpointsBuilder.build();
        notifyListeners(endpoints);
    } finally {
        endpointsLock.unlock();
    }
}

From source file:io.prestosql.sql.planner.plan.DistinctLimitNode.java

@Override
public List<Symbol> getOutputSymbols() {
    ImmutableList.Builder<Symbol> outputSymbols = ImmutableList.builder();
    outputSymbols.addAll(distinctSymbols);
    hashSymbol.ifPresent(outputSymbols::add);
    return outputSymbols.build();
}

From source file:com.spectralogic.ds3autogen.java.generators.requestmodels.NotificationRequestGenerator.java

/**
 * Gets the list of constructor models from a Ds3Request. The notification
 * constructor will have the parameter NotificationId
 *//*from w  ww. j  av a2  s .co m*/
@Override
public ImmutableList<RequestConstructor> toConstructorList(final Ds3Request ds3Request,
        final String requestName, final Ds3DocSpec docSpec) {
    final ImmutableList<Arguments> constructorArgs = toConstructorArgumentsList(ds3Request);

    final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
    builder.addAll(constructorArgs);
    builder.add(new Arguments("UUID", "NotificationId"));

    final ImmutableList<String> argNames = builder.build().stream().map(Arguments::getName)
            .collect(GuavaCollectors.immutableList());

    final RequestConstructor constructor = new RequestConstructor(builder.build(), constructorArgs,
            toQueryParamsList(ds3Request), toConstructorDocs(requestName, argNames, docSpec, 1));

    return ImmutableList.of(constructor);
}

From source file:org.lanternpowered.server.game.registry.type.extra.AccessoryRegistryModule.java

@Override
public List<CatalogMappingData> getCatalogMappings() {
    final ImmutableList.Builder<CatalogMappingData> mappingData = ImmutableList.builder();
    mappingData.addAll(super.getCatalogMappings());
    final ImmutableMap.Builder<String, Accessory> topHatMappings = ImmutableMap.builder();
    getAll().stream().filter(accessory -> accessory instanceof TopHat)
            .forEach(accessory -> topHatMappings.put(accessory.getName().replace("_top_hat", ""), accessory));
    mappingData.add(new CatalogMappingData(TopHats.class, topHatMappings.build()));
    return mappingData.build();
}

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

/**
 * @return all deps required by this header pack.
 *///  w w w  . j a va 2  s . c  om
@Override
public Iterable<BuildRule> getDeps(SourcePathRuleFinder ruleFinder) {
    ImmutableList.Builder<BuildRule> deps = ImmutableList.builder();
    deps.addAll(ruleFinder.filterBuildRuleInputs(getNameToPathMap().values()));
    deps.addAll(ruleFinder.filterBuildRuleInputs(getRoot()));
    deps.addAll(ruleFinder.filterBuildRuleInputs(getIncludeRoot()));
    deps.addAll(ruleFinder.filterBuildRuleInputs(OptionalCompat.asSet(getHeaderMap())));
    return deps.build();
}

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

/**
 * Build a list of compiler flag strings representing the contained paths.
 *
 * Paths are inserted into the compiler flag list as-is, without transformation or shortening.
 *///from w  w w  . j a  va  2s. co m
public ImmutableList<String> getFlags(SourcePathResolver pathResolver, Preprocessor preprocessor) {
    ImmutableList.Builder<String> builder = ImmutableList.builder();
    builder.addAll(CxxHeaders.getArgs(getIPaths(), pathResolver, Optional.empty(), preprocessor));
    // TODO(elsteveogrande) gotta handle framework paths!
    return builder.build();
}

From source file:com.spectralogic.ds3autogen.java.generators.responsemodels.PaginationResponseGenerator.java

/**
 * Retrieves the list of parameters need to create the response POJO and
 * adds the pagination parameters to the end of the list.
 *//*  w ww .  j av a2 s . c  om*/
@Override
public String toConstructorParams(final ImmutableList<Arguments> params) {
    final ImmutableList.Builder<Arguments> builder = ImmutableList.builder();
    if (hasContent(params)) {
        builder.addAll(params);
    }
    builder.add(new Arguments("Integer", "pagingTotalResultCount"));
    builder.add(new Arguments("Integer", "pagingTruncated"));

    return builder.build().stream().map(i -> "final " + i.getType() + " " + uncapFirst(i.getName()))
            .collect(Collectors.joining(", "));
}

From source file:com.facebook.buck.file.HttpArchive.java

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    ImmutableList.Builder<Step> steps = ImmutableList.builder();

    steps.addAll(MakeCleanDirectoryStep.of(BuildCellRelativePath
            .fromCellRelativePath(context.getBuildCellRootPath(), getProjectFilesystem(), output)));

    steps.add(getUnarchiveStep(getProjectFilesystem(),
            context.getSourcePathResolver().getAbsolutePath(implicitHttpFile.getSourcePathToOutput()), output,
            stripPrefix, format));//from ww w. j a  v  a2 s  .c  om

    buildableContext.recordArtifact(output);

    return steps.build();
}

From source file:org.sonar.java.model.ArrayDimensionTreeImpl.java

@Override
public Iterable<Tree> children() {
    ImmutableList.Builder<Tree> iteratorBuilder = ImmutableList.builder();
    iteratorBuilder.addAll(annotations);
    iteratorBuilder.add(openBracketToken);
    if (expression != null) {
        iteratorBuilder.add(expression);
    }//from  w ww .java 2s  .  c om
    iteratorBuilder.add(closeBracketToken);
    return iteratorBuilder.build();
}