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:com.spectralogic.ds3autogen.java.helpers.JavaHelper.java

/**
 * Sorts Elements. Used in Java model generation.
 *///from www. j  a  v a 2s .c om
public static ImmutableList<Element> sortModelConstructorArgs(final ImmutableList<Element> elements) {
    if (isEmpty(elements)) {
        return ImmutableList.of();
    }
    final List<Element> sortable = new ArrayList<>();
    sortable.addAll(elements);
    Collections.sort(sortable, new CustomElementComparator());

    final ImmutableList.Builder<Element> builder = ImmutableList.builder();
    builder.addAll(sortable);
    return builder.build();
}

From source file:io.prestosql.orc.writer.SliceDirectColumnWriter.java

private static List<Integer> createSliceColumnPositionList(boolean compressed,
        LongStreamCheckpoint lengthCheckpoint, ByteArrayStreamCheckpoint dataCheckpoint,
        Optional<BooleanStreamCheckpoint> presentCheckpoint) {
    ImmutableList.Builder<Integer> positionList = ImmutableList.builder();
    presentCheckpoint.ifPresent(//from w ww. j  a  v a 2s  .c om
            booleanStreamCheckpoint -> positionList.addAll(booleanStreamCheckpoint.toPositionList(compressed)));
    positionList.addAll(dataCheckpoint.toPositionList(compressed));
    positionList.addAll(lengthCheckpoint.toPositionList(compressed));
    return positionList.build();
}

From source file:com.google.template.soy.basicfunctions.BasicFunctionsRuntime.java

/** Concatenates its arguments. */
public static List<SoyValueProvider> concatLists(List<SoyList> args) {
    ImmutableList.Builder<SoyValueProvider> flattened = ImmutableList.builder();
    for (SoyList soyList : args) {
        flattened.addAll(soyList.asJavaList());
    }//from www .j a  v  a 2 s.  c o  m
    return flattened.build();
}

From source file:io.prestosql.orc.writer.StructColumnWriter.java

private static List<Integer> createStructColumnPositionList(boolean compressed,
        Optional<BooleanStreamCheckpoint> presentCheckpoint) {
    ImmutableList.Builder<Integer> positionList = ImmutableList.builder();
    presentCheckpoint.ifPresent(/*from   ww  w. j  a v  a  2s.  com*/
            booleanStreamCheckpoint -> positionList.addAll(booleanStreamCheckpoint.toPositionList(compressed)));
    return positionList.build();
}

From source file:io.prestosql.orc.writer.ListColumnWriter.java

private static List<Integer> createArrayColumnPositionList(boolean compressed,
        LongStreamCheckpoint lengthCheckpoint, Optional<BooleanStreamCheckpoint> presentCheckpoint) {
    ImmutableList.Builder<Integer> positionList = ImmutableList.builder();
    presentCheckpoint.ifPresent(//from   w  w  w  . j a v  a  2s  .c  o  m
            booleanStreamCheckpoint -> positionList.addAll(booleanStreamCheckpoint.toPositionList(compressed)));
    positionList.addAll(lengthCheckpoint.toPositionList(compressed));
    return positionList.build();
}

From source file:com.facebook.presto.orc.writer.TimestampColumnWriter.java

private static List<Integer> createTimestampColumnPositionList(boolean compressed,
        LongStreamCheckpoint secondsCheckpoint, LongStreamCheckpoint nanosCheckpoint,
        Optional<BooleanStreamCheckpoint> presentCheckpoint) {
    ImmutableList.Builder<Integer> positionList = ImmutableList.builder();
    presentCheckpoint.ifPresent(//from  ww w . ja v a2  s . c o  m
            booleanStreamCheckpoint -> positionList.addAll(booleanStreamCheckpoint.toPositionList(compressed)));
    positionList.addAll(secondsCheckpoint.toPositionList(compressed));
    positionList.addAll(nanosCheckpoint.toPositionList(compressed));
    return positionList.build();
}

From source file:com.google.devtools.build.lib.rules.cpp.CompileBuildVariables.java

/**
 * Supplier that computes legacy_compile_flags lazily at the execution phase.
 *
 * <p>Dear friends of the lambda, this method exists to limit the scope of captured variables only
 * to arguments (to prevent accidental capture of enclosing instance which could regress memory).
 *//*  w w w.j  a  v  a2  s  . c  om*/
private static Supplier<ImmutableList<String>> getLegacyCompileFlagsSupplier(CcToolchainProvider toolchain,
        boolean addLegacyCxxOptions) {
    return () -> {
        ImmutableList.Builder<String> legacyCompileFlags = ImmutableList.builder();
        legacyCompileFlags.addAll(toolchain.getLegacyCompileOptions());
        if (addLegacyCxxOptions) {
            legacyCompileFlags.addAll(toolchain.getLegacyCxxOptions());
        }
        return legacyCompileFlags.build();
    };
}

From source file:com.facebook.buck.cxx.toolchain.CxxPlatforms.java

public static Iterable<BuildTarget> getParseTimeDeps(CxxPlatform cxxPlatform) {
    ImmutableList.Builder<BuildTarget> deps = ImmutableList.builder();
    deps.addAll(cxxPlatform.getAspp().getParseTimeDeps());
    deps.addAll(cxxPlatform.getAs().getParseTimeDeps());
    deps.addAll(cxxPlatform.getCpp().getParseTimeDeps());
    deps.addAll(cxxPlatform.getCc().getParseTimeDeps());
    deps.addAll(cxxPlatform.getCxxpp().getParseTimeDeps());
    deps.addAll(cxxPlatform.getCxx().getParseTimeDeps());
    if (cxxPlatform.getCudapp().isPresent()) {
        deps.addAll(cxxPlatform.getCudapp().get().getParseTimeDeps());
    }//from  w  w w  .j  a va  2  s  .  c  o  m
    if (cxxPlatform.getCuda().isPresent()) {
        deps.addAll(cxxPlatform.getCuda().get().getParseTimeDeps());
    }
    if (cxxPlatform.getHippp().isPresent()) {
        deps.addAll(cxxPlatform.getHippp().get().getParseTimeDeps());
    }
    if (cxxPlatform.getHip().isPresent()) {
        deps.addAll(cxxPlatform.getHip().get().getParseTimeDeps());
    }
    if (cxxPlatform.getAsmpp().isPresent()) {
        deps.addAll(cxxPlatform.getAsmpp().get().getParseTimeDeps());
    }
    if (cxxPlatform.getAsm().isPresent()) {
        deps.addAll(cxxPlatform.getAsm().get().getParseTimeDeps());
    }
    deps.addAll(cxxPlatform.getLd().getParseTimeDeps());
    deps.addAll(cxxPlatform.getAr().getParseTimeDeps());
    if (cxxPlatform.getRanlib().isPresent()) {
        deps.addAll(cxxPlatform.getRanlib().get().getParseTimeDeps());
    }
    cxxPlatform.getSharedLibraryInterfaceParams().ifPresent(f -> deps.addAll(f.getParseTimeDeps()));
    return deps.build();
}

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

public static Iterable<BuildTarget> getParseTimeDeps(Iterable<CxxPlatform> cxxPlatforms) {
    ImmutableList.Builder<BuildTarget> deps = ImmutableList.builder();
    for (CxxPlatform cxxPlatform : cxxPlatforms) {
        deps.addAll(getParseTimeDeps(cxxPlatform));
    }//w w  w  . j a  v a  2s. c  om
    return deps.build();
}

From source file:com.opera.core.systems.OperaBinary.java

private static List<String> buildMobilePaths() {
    ImmutableList.Builder<String> paths = ImmutableList.builder();

    if (platform.is(Platform.WINDOWS)) {
        paths.addAll(WindowsUtils.getPathsInProgramFiles("Opera Mobile Emulator\\OperaMobileEmu.exe"));
        return paths.build();
    }/*from   w  ww .  j  av a2  s  .  co  m*/

    String path = "";
    switch (platform) {
    case LINUX:
    case UNIX:
        path = "/usr/bin";
        break;

    case MAC:
        path = "/Applications/Opera Mobile Emulator.app/Contents/Resources/Opera Mobile.app/Contents/MacOS";
        break;
    }

    for (String binary : buildMobileBinaries()) {
        paths.add(path + binary);
    }

    return paths.build();
}