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

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

Introduction

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

Prototype

boolean add(E e);

Source Link

Document

Appends the specified element to the end of this list (optional operation).

Usage

From source file:com.spectralogic.ds3client.helpers.RangeHelper.java

static void addRemainingRanges(final UnmodifiableIterator<Range> existingRangesIterator,
        final ImmutableList.Builder<Range> newRangesbuilder) {
    while (existingRangesIterator.hasNext()) {
        newRangesbuilder.add(existingRangesIterator.next());
    }/*from w w w  . ja  v  a 2  s .c  o m*/
}

From source file:com.squareup.wire.schema.Type.java

static ImmutableList<TypeElement> toElements(ImmutableList<Type> types) {
    ImmutableList.Builder<TypeElement> elements = new ImmutableList.Builder<>();
    for (Type type : types) {
        elements.add(Type.toElement(type));
    }// ww  w.  j  av a  2 s.  c  om
    return elements.build();
}

From source file:com.android.tools.idea.run.DeviceFutures.java

@NotNull
public static DeviceFutures forDevices(@NotNull Iterable<IDevice> devices) {
    ImmutableList.Builder<AndroidDevice> futures = ImmutableList.builder();
    for (IDevice device : devices) {
        futures.add(new ConnectedAndroidDevice(device, null));
    }/* w ww . j  av  a  2  s  .  co m*/
    return new DeviceFutures(futures.build());
}

From source file:org.gradle.launcher.daemon.server.DaemonExpirationStrategies.java

public static DaemonExpirationStrategy getDefaultStrategy(Daemon daemon, DaemonServices daemonServices,
        final DaemonServerConfiguration params) {
    ImmutableList.Builder<DaemonExpirationStrategy> strategies = ImmutableList
            .<DaemonExpirationStrategy>builder();
    strategies.add(getHealthStrategy(daemonServices.get(DaemonHealthServices.class).getDaemonStatus()));
    strategies.add(// w ww . jav  a2 s  .  com
            new DaemonIdleTimeoutExpirationStrategy(daemon, params.getIdleTimeout(), TimeUnit.MILLISECONDS));
    try {
        strategies
                .add(new AllDaemonExpirationStrategy(ImmutableList.of(
                        new DaemonIdleTimeoutExpirationStrategy(daemon, params.getIdleTimeout() / 8,
                                TimeUnit.MILLISECONDS),
                        LowMemoryDaemonExpirationStrategy.belowFreePercentage(0.2))));
    } catch (UnsupportedOperationException e) {
        logger.info("This JVM does not support getting free system memory, so daemons will not check for it");
    }

    strategies.add(new DaemonRegistryUnavailableExpirationStrategy(daemon));
    return new AnyDaemonExpirationStrategy(strategies.build());
}

From source file:com.proofpoint.jaxrs.BeanValidationException.java

private static List<String> messagesFor(Set<ConstraintViolation<Object>> violations) {
    ImmutableList.Builder<String> messages = new ImmutableList.Builder<>();
    for (ConstraintViolation<?> violation : violations) {
        messages.add(violation.getPropertyPath().toString() + " " + violation.getMessage());
    }//from w w w .j  a  v a  2s  .  c o m

    return messages.build();
}

From source file:com.spectralogic.ds3client.helpers.strategy.transferstrategy.RangeHelper.java

private static void addRemainingRanges(final UnmodifiableIterator<Range> existingRangesIterator,
        final ImmutableList.Builder<Range> newRangesbuilder) {
    while (existingRangesIterator.hasNext()) {
        newRangesbuilder.add(existingRangesIterator.next());
    }//from w  w  w.  j a  v a  2  s  .co  m
}

From source file:org.retrostore.rpc.GetAppFormDataRpcCall.java

private static List<DropdownValueForClient> forAuthors(List<Author> authors) {
    ImmutableList.Builder<DropdownValueForClient> builder = ImmutableList.builder();
    for (Author author : authors) {
        builder.add(new DropdownValueForClient(String.valueOf(author.id), author.name));
    }/* w w w  .  j a  v  a2  s.c om*/
    return builder.build();
}

From source file:com.facebook.presto.sql.parser.TreePrinter.java

private static List<Tree> children(Tree tree) {
    ImmutableList.Builder<Tree> list = ImmutableList.builder();
    for (int i = 0; i < tree.getChildCount(); i++) {
        list.add(tree.getChild(i));
    }/*from ww w .j  a  v a 2 s  .  com*/
    return list.build();
}

From source file:com.squareup.wire.schema.OneOf.java

static ImmutableList<OneOfElement> toElements(ImmutableList<OneOf> oneOfs) {
    ImmutableList.Builder<OneOfElement> elements = new ImmutableList.Builder<>();
    for (OneOf oneOf : oneOfs) {
        elements.add(OneOfElement.builder().documentation(oneOf.documentation).name(oneOf.name)
                .fields(Field.toElements(oneOf.fields)).build());
    }// ww w.  j  a v  a  2 s. c o m
    return elements.build();
}

From source file:com.squareup.wire.schema.Extensions.java

static ImmutableList<Extensions> fromElements(ImmutableList<ExtensionsElement> elements) {
    ImmutableList.Builder<Extensions> extensions = ImmutableList.builder();
    for (ExtensionsElement element : elements) {
        extensions.add(
                new Extensions(element.location(), element.documentation(), element.start(), element.end()));
    }//from   w  w  w .j a va  2 s.  c  o  m
    return extensions.build();
}