List of usage examples for com.google.common.collect ImmutableList copyOf
public static <E> ImmutableList<E> copyOf(E[] elements)
From source file:com.ibm.og.supplier.Suppliers.java
/** * Creates a supplier that returns values in a cycle * /* w w w . j av a 2s. c om*/ * @param values the values to supply * @return a supplier which supplies values in a cycle * @throws NullPointerException if values is null or contains null elements */ public static <T> Supplier<T> cycle(final List<T> values) { final List<T> copy = ImmutableList.copyOf(values); checkArgument(!copy.isEmpty(), "values must not be empty"); final Iterator<T> it = Iterators.cycle(copy); return new Supplier<T>() { @Override public T get() { return it.next(); } @Override public String toString() { return String.format("cycle %s", copy); } }; }
From source file:com.google.errorprone.refaster.UTypeParameter.java
static UTypeParameter create(CharSequence name, Iterable<? extends UExpression> bounds, Iterable<? extends UAnnotation> annotations) { return new AutoValue_UTypeParameter(StringName.of(name), ImmutableList.copyOf(bounds), ImmutableList.copyOf(annotations)); }
From source file:com.enonic.cms.business.portal.livetrace.LongestPortalRequests.java
public synchronized List<PortalRequestTrace> getList() { return ImmutableList.copyOf(list); }
From source file:com.google.devtools.moe.client.testing.DummyCommit.java
/** returns a commit containing the usual metadata and ancestor commit(s) */ public static DummyCommit create(String id, String author, String description, DateTime timestamp, DummyCommit... parents) {//from w w w . ja va2 s . c om return new AutoValue_DummyCommit(id, author, description, timestamp, ImmutableList.copyOf(parents)); }
From source file:com.cdancy.etcd.rest.domain.members.Member.java
@SerializedNames({ "id", "name", "peerURLs", "clientURLs", "message" }) public static Member create(String id, String name, List<String> peerURLs, List<String> clientURLs, ErrorMessage errorMessage) {//w ww .j a v a 2s . c o m return new AutoValue_Member(id, name, peerURLs != null ? ImmutableList.copyOf(peerURLs) : ImmutableList.<String>of(), clientURLs != null ? ImmutableList.copyOf(clientURLs) : ImmutableList.<String>of(), errorMessage); }
From source file:com.xebialabs.deployit.ci.util.Strings2.java
public static List<String> commaSeparatedListToList(String commaSeparatedList) { return ImmutableList.copyOf(Splitter.on(COMMA_SEPARATOR).trimResults().split(commaSeparatedList)); }
From source file:com.spotify.missinglink.datamodel.MethodDescriptors.java
private static MethodDescriptor newDescriptor(MethodKey key) { Type type = Type.getMethodType(key.desc); List<TypeDescriptor> params = Arrays.stream(type.getArgumentTypes()).map(Type::getDescriptor) .map(TypeDescriptors::fromRaw).collect(toList()); return new MethodDescriptorBuilder() .returnType(TypeDescriptors.fromRaw(type.getReturnType().getDescriptor())).name(key.name) .parameterTypes(ImmutableList.copyOf(params)).build(); }
From source file:com.facebook.presto.cassandra.CassandraQueryRunner.java
public static DistributedQueryRunner createCassandraQueryRunner(TpchTable<?>... tables) throws Exception { return createCassandraQueryRunner(ImmutableList.copyOf(tables)); }
From source file:ps3joiner.SplitFilesVisitor.java
public List<Path> foundPaths() { return ImmutableList.copyOf(foundPaths); }
From source file:com.tozny.mobiledemo.User.java
public User(String email, @Nullable String toznyId, @Nullable List<Device> devices) { this.email = email; this.toznyId = toznyId; this.devices = devices != null ? ImmutableList.copyOf(devices) : ImmutableList.of(); }