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:org.sonar.java.model.declaration.ModuleDeclarationTreeImpl.java

@Override
protected Iterable<Tree> children() {
    ImmutableList.Builder<Tree> iteratorBuilder = ImmutableList.<Tree>builder();
    iteratorBuilder.addAll(annotations);
    if (openKeyword != null) {
        iteratorBuilder.add(openKeyword);
    }//  ww  w.j av a2s .  co  m
    iteratorBuilder.add(moduleKeyword, qualifiedIdentifier, openBraceToken);
    iteratorBuilder.addAll(moduleDirectives);
    iteratorBuilder.add(closeBraceToken);
    return iteratorBuilder.build();
}

From source file:com.facebook.buck.rust.RustBuckConfig.java

ImmutableList<String> getLinkerArgs(CxxPlatform cxxPlatform) {
    ImmutableList.Builder<String> linkargs = ImmutableList.builder();

    linkargs.addAll(delegate.getListWithoutComments(SECTION, "linker_args"));

    if (!delegate.getPath(SECTION, "linker").isPresent()) {
        linkargs.addAll(cxxPlatform.getLdflags());
    }//ww w  .  j a v a  2 s  .com

    return linkargs.build();
}

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

@Override
public ImmutableList<Artifact> getManifests() {
    ImmutableList.Builder<Artifact> result = ImmutableList.builder();
    for (RunfilesSupplier supplier : suppliers) {
        result.addAll(supplier.getManifests());
    }//  w  w w.j  ava 2 s  .co  m
    return result.build();
}

From source file:com.facebook.buck.features.dotnet.CsharpLibrary.java

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    ProjectFilesystem filesystem = getProjectFilesystem();

    ImmutableSortedSet<Path> sourceFiles = context.getSourcePathResolver().getAllAbsolutePaths(srcs);

    ImmutableListMultimap.Builder<Path, String> resolvedResources = ImmutableListMultimap.builder();
    for (Map.Entry<String, SourcePath> resource : resources.entrySet()) {
        resolvedResources.put(context.getSourcePathResolver().getAbsolutePath(resource.getValue()),
                resource.getKey());//from   ww  w  .ja  va  2 s .  com
    }

    ImmutableList<Either<Path, String>> references = resolveReferences(context.getSourcePathResolver(), refs);

    ImmutableList.Builder<Step> steps = ImmutableList.builder();

    steps.addAll(MakeCleanDirectoryStep.of(BuildCellRelativePath
            .fromCellRelativePath(context.getBuildCellRootPath(), getProjectFilesystem(), output.getParent())));
    steps.add(new CsharpLibraryCompile(context.getSourcePathResolver(), csharpCompiler,
            filesystem.resolve(output), sourceFiles, references, resolvedResources.build(), version));

    buildableContext.recordArtifact(output);

    return steps.build();
}

From source file:org.sonar.php.PHPAnalyzer.java

public List<Issue> analyze() {
    ImmutableList.Builder<Issue> issuesBuilder = ImmutableList.builder();
    for (PHPCheck check : checks) {
        issuesBuilder.addAll(check.analyze(currentFile, currentFileTree, currentFileSymbolTable));
    }//from ww w.  j  a v a2s .c o m

    return issuesBuilder.build();
}

From source file:org.apache.james.transport.mailets.redirect.NotifyMailetsMessage.java

private List<String> flatten(String[] addresses) {
    final ImmutableList.Builder<String> builder = ImmutableList.builder();
    for (String address : addresses) {
        builder.addAll(Splitter.on(',').trimResults().split(address));
    }//from  www. j a  v a2 s  . c o  m
    return builder.build();
}

From source file:com.google.api.codegen.transformer.py.PythonGapicSamplesTransformer.java

@Override
public List<ViewModel> transform(ProtoApiModel apiModel, GapicProductConfig productConfig) {
    ImmutableList.Builder<ViewModel> views = ImmutableList.builder();
    views.addAll(generateSampleFiles(apiModel, productConfig));
    return views.build();
}

From source file:com.facebook.buck.cli.SimulateCommand.java

@Override
protected ImmutableList<String> getOptions() {
    ImmutableList.Builder<String> builder = ImmutableList.builder();
    builder.addAll(super.getOptions());
    if (simulateTimesFile != null) {
        builder.add(TIMES_FILE_STRING_ARG);
        builder.add(simulateTimesFile);/*from w w w . ja va  2s  .  c o  m*/
    }

    if (simulateReportFile != null) {
        builder.add(REPORT_FILE_STRING_ARG);
        builder.add(simulateReportFile);
    }

    builder.add(RULE_FALLBACK_TIME_MILLIS_ARG);
    builder.add(Long.toString(ruleFallbackTimeMillis));

    return builder.build();
}

From source file:com.wrmsr.neurosis.launcher.util.SubprocessSshClient.java

@Override
public Session run(String... commands) throws IOException {
    ImmutableList.Builder<String> argsBuilder = ImmutableList.builder();
    argsBuilder.add("ssh");
    argsBuilder.addAll(getCommonArgs());
    argsBuilder.addAll(Arrays.asList(commands));
    FinalizedProcessBuilder processBuilder = new FinalizedProcessBuilder(argsBuilder.build());
    return new Session(processBuilder.start());
}

From source file:com.facebook.buck.features.d.DBuckConfig.java

/** @return a list of flags that must be passed to the linker to link D binaries. */
public ImmutableList<String> getLinkerFlags() {
    Optional<ImmutableList<String>> configuredFlags = delegate.getOptionalListWithoutComments("d",
            "linker_flags", ' ');
    if (configuredFlags.isPresent()) {
        return configuredFlags.get();
    } else {/*w  ww .  java2s.c o m*/
        // No flags configured; generate them based on library paths.
        ImmutableList.Builder<String> builder = ImmutableList.builder();
        builder.addAll(StreamSupport.stream(getBaseLibraryPaths().spliterator(), false)
                .map(input -> "-L" + input).iterator());
        builder.add("-lphobos2", "-lpthread", "-lm");
        return builder.build();
    }
}