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.facebook.buck.rules.CommandTool.java

@Override
public ImmutableList<String> getCommandPrefix(SourcePathResolver resolver) {
    ImmutableList.Builder<String> command = ImmutableList.builder();
    if (baseTool.isPresent()) {
        command.addAll(baseTool.get().getCommandPrefix(resolver));
    }//from w w  w.ja v a2s  .  c o m
    for (Arg arg : args) {
        arg.appendToCommandLine(command);
    }
    return command.build();
}

From source file:com.facebook.presto.verifier.checksum.ChecksumValidator.java

public Query generateChecksumQuery(QualifiedName tableName, List<Column> columns) {
    ImmutableList.Builder<SelectItem> selectItems = ImmutableList.builder();
    selectItems.add(new SingleColumn(new FunctionCall(QualifiedName.of("count"), ImmutableList.of())));
    for (Column column : columns) {
        selectItems.addAll(columnValidators.get(column.getCategory()).generateChecksumColumns(column));
    }//from   w w w .j  a  v  a2  s  .c om
    return simpleQuery(new Select(false, selectItems.build()), new Table(tableName));
}

From source file:org.eclipse.mylyn.internal.wikitext.commonmark.inlines.InlinesSubstitution.java

public List<Inline> apply(List<Inline> inlines) {
    ImmutableList.Builder<Inline> builder = ImmutableList.builder();

    boolean inReplacementSegment = false;
    for (Inline inline : inlines) {
        if (inline == first) {
            inReplacementSegment = true;
            builder.addAll(substitution);
        }//from w  w  w.ja  v  a  2  s.c  o  m
        if (!inReplacementSegment) {
            builder.add(inline);
        }
        if (inReplacementSegment && inline == last) {
            inReplacementSegment = false;
        }
    }
    return builder.build();
}

From source file:google.registry.tools.AuctionStatusCommand.java

@Override
public void run() throws Exception {
    final ImmutableSet<String> domains = ImmutableSet.copyOf(mainArguments);
    Files.write(output,// w  w w . j  a  v  a  2s  .  c  om
            FluentIterable.from(domains).transformAndConcat(new Function<String, Iterable<String>>() {
                @Override
                public Iterable<String> apply(String fullyQualifiedDomainName) {
                    checkState(findTldForName(InternetDomainName.from(fullyQualifiedDomainName)).isPresent(),
                            "No tld found for %s", fullyQualifiedDomainName);
                    return ofy().transactNewReadOnly(new Work<Iterable<String>>() {
                        @Override
                        public Iterable<String> run() {
                            ImmutableList.Builder<DomainApplication> applications = new ImmutableList.Builder<>();
                            for (String domain : domains) {
                                applications.addAll(
                                        loadActiveApplicationsByDomainName(domain, ofy().getTransactionTime()));
                            }
                            return Lists.transform(
                                    FluentIterable.from(applications.build()).toSortedList(ORDERING),
                                    APPLICATION_FORMATTER);
                        }
                    });
                }
            }), UTF_8);
}

From source file:org.obiba.opal.web.r.OpalRSessionResourceImpl.java

@Override
public List<OpalR.RCommandDto> getRCommands() {
    ImmutableList.Builder<OpalR.RCommandDto> commands = ImmutableList.builder();

    commands.addAll(
            Iterables.transform(getOpalRSession().getRCommands(), new Function<RCommand, OpalR.RCommandDto>() {
                @Nullable/*from   ww  w  . java 2s  .c  o  m*/
                @Override
                public OpalR.RCommandDto apply(@Nullable RCommand rCommand) {
                    return asDto(rCommand);
                }
            }));

    return commands.build();
}

From source file:org.xacml4j.v30.AttributeContainer.java

/**
 * Gets all {@link AttributeExp} instances
 * contained in this attributes instance
 *
 * @param attributeId an attribute id/* www. ja v  a 2s .c  o m*/
 * @param issuer an attribute issuer
 * @param type an attribute value data type
 * @return a collection of {@link AttributeExp} instances
 */
public Collection<AttributeExp> getAttributeValues(String attributeId, String issuer,
        final AttributeExpType type) {
    Preconditions.checkNotNull(type);
    Collection<Attribute> found = getAttributes(attributeId, issuer);
    ImmutableList.Builder<AttributeExp> b = ImmutableList.builder();
    for (Attribute a : found) {
        b.addAll(a.getValuesByType(type));
    }
    return b.build();
}

From source file:com.facebook.buck.lua.AbstractNativeExecutableStarter.java

private ImmutableList<CxxPreprocessorInput> getTransitiveCxxPreprocessorInput(CxxPlatform cxxPlatform,
        Iterable<? extends CxxPreprocessorDep> deps) throws NoSuchBuildTargetException {
    ImmutableList.Builder<CxxPreprocessorInput> inputs = ImmutableList.builder();
    inputs.addAll(CxxPreprocessables.getTransitiveCxxPreprocessorInput(cxxPlatform,
            FluentIterable.from(deps).filter(BuildRule.class)));
    for (CxxPreprocessorDep dep : Iterables.filter(deps, Predicates.not(BuildRule.class::isInstance))) {
        inputs.add(dep.getCxxPreprocessorInput(cxxPlatform, HeaderVisibility.PUBLIC));
    }//www.j a v  a  2 s  .c o  m
    return inputs.build();
}

From source file:org.apache.aurora.scheduler.Resources.java

private Iterable<Range> getPortRanges() {
    ImmutableList.Builder<Range> ranges = ImmutableList.builder();
    for (Resource r : getResources(PORTS.getName())) {
        ranges.addAll(r.getRanges().getRangeList().iterator());
    }/*w  ww. ja  v a 2 s. co  m*/

    return ranges.build();
}

From source file:com.facebook.presto.verifier.source.AbstractJdbiSourceQuerySupplier.java

@Override
public List<SourceQuery> get() {
    ImmutableList.Builder<SourceQuery> sourceQueries = ImmutableList.builder();
    try (Handle handle = jdbiProvider.get().open()) {
        VerifierDao verifierDao = handle.attach(VerifierDao.class);
        for (String suite : suites) {
            sourceQueries.addAll(verifierDao.getSourceQueries(tableName, suite, maxQueriesPerSuite));
        }/* ww w .  j a v a2 s  .co m*/
    }
    return sourceQueries.build();
}

From source file:org.opendaylight.protocol.bmp.parser.message.PeerUpHandler.java

@Override
protected void addTlv(final InformationBuilder builder, final Tlv tlv) {
    if (tlv instanceof StringTlv) {
        final ImmutableList.Builder stringInfoListBuilder = ImmutableList.<StringInformation>builder();
        if (builder.getStringInformation() != null) {
            stringInfoListBuilder.addAll(builder.getStringInformation());
        }/*w w  w. j  a  v a 2  s.co m*/
        builder.setStringInformation(stringInfoListBuilder.add(new StringInformationBuilder()
                .setStringTlv(new StringTlvBuilder((StringTlv) tlv).build()).build()).build());
    }
}