List of usage examples for com.google.common.collect ImmutableList copyOf
public static <E> ImmutableList<E> copyOf(E[] elements)
From source file:com.facebook.buck.rules.coercer.SourceWithFlags.java
public static SourceWithFlags of(SourcePath sourcePath, List<String> flags) { return ImmutableSourceWithFlags.of(sourcePath, ImmutableList.copyOf(flags)); }
From source file:com.twitter.heron.metricscachemgr.metricscache.query.MetricResponse.java
public MetricResponse(Collection<MetricDatum> list) { metricList = ImmutableList.copyOf(list); }
From source file:com.axemblr.service.cm.models.tools.ErrorMessage.java
@JsonCreator public ErrorMessage(@JsonProperty("message") String message, @JsonProperty("causes") List<String> causes) { this.message = message; this.causes = (causes == null) ? ImmutableList.<String>of() : ImmutableList.copyOf(causes); }
From source file:org.trancecode.io.Files.java
public static List<File> listDirectories(final File directory) { Preconditions.checkNotNull(directory); return ImmutableList.copyOf(directory.listFiles(FileFilters.isDirectory())); }
From source file:org.glowroot.agent.weaving.AdviceMatcher.java
static ImmutableList<AdviceMatcher> getAdviceMatchers(String className, List<String> classAnnotations, Collection<String> superClassNames, List<Advice> advisors) { List<AdviceMatcher> adviceMatchers = Lists.newArrayList(); for (Advice advice : advisors) { if (isClassMatch(className, classAnnotations, superClassNames, advice)) { adviceMatchers.add(ImmutableAdviceMatcher.of(advice)); }// w w w .ja v a2 s. c o m } return ImmutableList.copyOf(adviceMatchers); }
From source file:com.google.devtools.moe.client.github.PullRequestUrl.java
/** * Create from a URL string, throwing an {@link InvalidGithubUrl} exception if the supplied * URL is invalid.//from w ww .jav a2 s .co m */ static PullRequestUrl create(URL url) { if (!url.getHost().equals("github.com")) { throw new InvalidGithubUrl("Pull request url is not a github.com url: '%s'", url); } ImmutableList<String> path = ImmutableList.copyOf(url.getPath().substring(1).split("/")); if (path.size() != 4 || !path.get(2).equals("pull")) { throw new InvalidGithubUrl("Invalid pull request URL: '%s'", url); } try { return new AutoValue_PullRequestUrl(path.get(0), path.get(1), Integer.parseInt(path.get(3))); } catch (NumberFormatException nfe) { throw new InvalidGithubUrl("Invalid pull request number '%s': '%s'", path.get(3), url); } }
From source file:de.brands4friends.daleq.core.EnumeratingTemplateValue.java
public EnumeratingTemplateValue(final List<T> values) { this.values = ImmutableList.copyOf(values); }
From source file:com.google.gxp.compiler.base.Util.java
/** * Given a function and a list, returns a list such that each element of the * result is the corresponding element of the input list mapped through the * input function. Unlike Lists.transform the result is <em>not</em> a lazy * view, and null elements in the result are disallowed. This is very * similar to the map function in Python and Scheme, except the parameters * are reversed for consistency with Lists.transform. * * @throws NullPointerException if any of resulting elements would be null. *///w w w . j a v a2 s.c om public static <K, V> ImmutableList<V> map(List<K> fromList, Function<? super K, ? extends V> function) { return ImmutableList.copyOf(Lists.transform(fromList, function)); }
From source file:org.gradle.language.nativeplatform.internal.incremental.sourceparser.IncludeWithSimpleExpression.java
public static Include create(Expression expression, boolean isImport) { if (expression.getType() == IncludeType.MACRO_FUNCTION && !expression.getArguments().isEmpty()) { return new IncludeWithMacroFunctionCallExpression(expression.getValue(), isImport, ImmutableList.copyOf(expression.getArguments())); }/*w w w . j av a 2 s. c o m*/ return create(expression.getValue(), isImport, expression.getType()); }
From source file:com.google.template.soy.jbcsrc.ConstructorRef.java
/** * Returns a new {@link ConstructorRef} that refers to a constructor on the given type with the * given parameter types.// w ww . j a va2s .c o m */ static ConstructorRef create(TypeInfo type, Method init) { checkArgument(init.getName().equals("<init>") && init.getReturnType().equals(Type.VOID_TYPE), "'%s' is not a valid constructor", init); return new AutoValue_ConstructorRef(type, init, ImmutableList.copyOf(init.getArgumentTypes())); }