Example usage for com.google.common.collect ImmutableList copyOf

List of usage examples for com.google.common.collect ImmutableList copyOf

Introduction

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

Prototype

public static <E> ImmutableList<E> copyOf(E[] elements) 

Source Link

Usage

From source file:com.github.tomakehurst.wiremock.matching.ContentPatternDeserialiser.java

private static boolean isAbsent(JsonNode rootNode) {
    for (Map.Entry<String, JsonNode> node : ImmutableList.copyOf(rootNode.fields())) {
        if (node.getKey().equals("absent")) {
            return true;
        }//  w ww  .j  a  v  a 2  s  .  c  o m
    }

    return false;
}

From source file:org.apache.jclouds.oneandone.rest.domain.SshKey.java

@SerializedNames({ "id", "name", "description", "state", "servers", "md5", "public_key", "creation_date" })
public static SshKey create(String id, String name, String description, GenericState state,
        List<Server> servers, String md5, String publicKey, String creationDate) {
    return new AutoValue_SshKey(id, name, description, state,
            servers == null ? ImmutableList.<Server>of() : ImmutableList.copyOf(servers), md5, publicKey,
            creationDate);// w w  w .  j a v a 2  s . co  m
}

From source file:de.flapdoodle.javaparser.tree.MethodDeclaration.java

public MethodDeclaration(Marker marker, String name, List<Parameter> parameters) {
    super(marker);
    _parameters = ImmutableList.copyOf(parameters);
    _name = name.trim();
}

From source file:io.airlift.drift.client.address.SimpleAddressSelectorBinder.java

public static AddressSelectorBinder simpleAddressSelector(List<HostAndPort> defaultAddresses) {
    requireNonNull(defaultAddresses, "defaultAddresses is null");
    checkArgument(!defaultAddresses.isEmpty(), "defaultAddresses is empty");
    return new SimpleAddressSelectorBinder(Optional.of(ImmutableList.copyOf(defaultAddresses)));
}

From source file:com.tomtom.speedtools.objects.Immutables.java

/**
 * Returns the immutable version of given collection. When given collection was already immutable, this collection
 * is simply returned.//from w  w  w .j ava2s .  co  m
 *
 * @param <T>  Element type.
 * @param elts Elements for the list.
 * @return Immutable list.
 */
@Nonnull
public static <T> Collection<T> copyOf(@Nonnull final Collection<? extends T> elts) {
    assert elts != null;
    if (elts instanceof Set) {
        return ImmutableSet.copyOf(elts);
    } else {
        return ImmutableList.copyOf(elts);
    }
}

From source file:com.axemblr.service.cm.models.cm.BulkCommandList.java

@JsonCreator
public BulkCommandList(@JsonProperty("items") List<Command> items, @JsonProperty("error") List<String> errors) {
    super(items);
    this.errors = (errors == null) ? ImmutableList.<String>of() : ImmutableList.copyOf(errors);
}

From source file:io.prestosql.plugin.kudu.properties.RangeBoundValue.java

public RangeBoundValue(List<Object> values) {
    this.values = ImmutableList.copyOf(values);
}

From source file:org.asoem.greyfish.utils.space.cluster.DBSCANCluster.java

public static <O> DBSCANCluster<O> create(final Collection<? extends O> objects) {
    checkNotNull(objects);//from  w  ww.ja v  a  2s.  c o  m
    return new DBSCANCluster<>(ImmutableList.copyOf(objects));
}

From source file:com.facebook.presto.hive.HiveQueryRunner.java

public static QueryRunner createQueryRunner(TpchTable<?>... tables) throws Exception {
    return createQueryRunner(ImmutableList.copyOf(tables));
}

From source file:com.facebook.buck.rules.coercer.ListConcatenatingCoercer.java

@Override
public Object concat(Iterable<Object> elements) {
    Iterable<List<Object>> lists = Iterables.transform(elements, List.class::cast);
    return ImmutableList.copyOf(Iterables.concat(lists));
}