List of usage examples for com.google.common.collect ImmutableList copyOf
public static <E> ImmutableList<E> copyOf(E[] elements)
From source file:com.spotify.asyncdatastoreclient.QueryResult.java
static QueryResult build(final DatastoreV1.RunQueryResponse response) { final DatastoreV1.QueryResultBatch batch = response.getBatch(); return new QueryResult( ImmutableList.copyOf(batch.getEntityResultList().stream() .map(entity -> Entity.builder(entity.getEntity()).build()).collect(Collectors.toList())), batch.hasEndCursor() ? batch.getEndCursor() : null); }
From source file:org.caleydo.core.view.opengl.layout2.dnd.FileDragInfo.java
public FileDragInfo(Collection<File> files) { this.files = ImmutableList.copyOf(files); }
From source file:ch.raffael.contracts.processor.cel.ParseException.java
public ParseException(List<CelError> errors) { this.errors = ImmutableList.copyOf(errors); }
From source file:com.spotify.heroic.metric.QueryResultPart.java
public static Transform<FullQuery, QueryResultPart> fromResultGroup(final ClusterShard shard) { return result -> { final ImmutableList<ShardedResultGroup> groups = ImmutableList .copyOf(result.getGroups().stream().map(ResultGroup.toShardedResultGroup(shard)).iterator()); final long preAggregationSampleSize = result.getStatistics() .getCounterValue(AggregationInstance.SAMPLE_SIZE).orElseGet(() -> { long sum = 0; for (final ShardedResultGroup g : groups) { sum += g.getMetrics().getData().size(); }/*from www .ja v a 2 s. c o m*/ return sum; }); return new QueryResultPart(groups, result.getErrors(), result.getTrace(), result.getLimits(), preAggregationSampleSize); }; }
From source file:org.glowroot.storage.repo.Result.java
public Result(List<T> records, boolean moreAvailable) { this.records = ImmutableList.copyOf(records); this.moreAvailable = moreAvailable; }
From source file:de.rnd7.movietools.util.FileTraverser.java
@Override public Iterable<File> children(final File file) { if (file.isDirectory() && !file.getName().startsWith(".")) { return ImmutableList.copyOf(file.listFiles()); } else {/*from w w w . ja v a2s . c o m*/ return ImmutableList.of(); } }
From source file:com.google.template.soy.soytree.RequirecssUtils.java
/** * Parses a 'requirecss' attribute value (for a Soy file or a template). * * @param requirecssAttr The 'requirecss' attribute value to parse. * @return A list of required CSS namespaces parsed from the given attribute value. */// w w w. j av a2 s . co m public static ImmutableList<String> parseRequirecssAttr(@Nullable String requirecssAttr) { if (requirecssAttr == null) { return ImmutableList.of(); } String[] namespaces = requirecssAttr.trim().split("\\s*,\\s*"); for (String namespace : namespaces) { if (!BaseUtils.isDottedIdentifier(namespace)) { throw SoySyntaxException .createWithoutMetaInfo("Invalid required CSS namespace name \"" + namespace + "\"."); } } return ImmutableList.copyOf(namespaces); }
From source file:com.wrmsr.wava.java.lang.tree.expression.JLongArrayLiteral.java
public JLongArrayLiteral(List<JExpression> items) { this.items = ImmutableList.copyOf(items); }
From source file:org.apache.aurora.common.base.Closures.java
/** * Combines multiple closures into a single closure, whose calls are replicated sequentially * in the order that they were provided. * If an exception is encountered from a closure it propagates to the top-level closure and the * remaining closures are not executed.// ww w . jav a 2s. co m * * @param closures Closures to combine. * @param <T> Type accepted by the closures. * @return A single closure that will fan out all calls to {@link Closure#execute(Object)} to * the wrapped closures. */ public static <T> Closure<T> combine(Iterable<Closure<T>> closures) { checkNotNull(closures); checkArgument(Iterables.all(closures, Predicates.notNull())); final Iterable<Closure<T>> closuresCopy = ImmutableList.copyOf(closures); return item -> { for (Closure<T> closure : closuresCopy) { closure.execute(item); } }; }
From source file:com.wrmsr.wava.java.lang.tree.declaration.JDeclarationBlock.java
public JDeclarationBlock(List<JDeclaration> body) { this.body = ImmutableList.copyOf(body); }