List of usage examples for com.google.common.collect ImmutableList of
@SuppressWarnings("unchecked") public static <E> ImmutableList<E> of()
From source file:com.google.errorprone.util.ErrorProneTokens.java
/** Returns the tokens for the given source text, including comments. */ public static ImmutableList<ErrorProneToken> getTokens(String source, Context context) { if (source == null) { return ImmutableList.of(); }/*from w w w. ja va2 s . co m*/ ScannerFactory fac = ScannerFactory.instance(context); char[] buffer = source.toCharArray(); Scanner scanner = new AccessibleScanner(fac, new CommentSavingTokenizer(fac, buffer, buffer.length)); ImmutableList.Builder<ErrorProneToken> tokens = ImmutableList.builder(); do { scanner.nextToken(); tokens.add(new ErrorProneToken(scanner.token())); } while (scanner.token().kind != TokenKind.EOF); return tokens.build(); }
From source file:com.spotify.heroic.suggest.WriteSuggest.java
public static WriteSuggest of(final long time) { return new WriteSuggest(ImmutableList.of(), ImmutableList.of(time), ImmutableList.of()); }
From source file:com.spotify.heroic.metadata.DeleteSeries.java
public static DeleteSeries of() { return new DeleteSeries(ImmutableList.of(), 0, 0); }
From source file:com.spotify.heroic.metadata.CountSeries.java
public static CountSeries of() { return new CountSeries(ImmutableList.of(), 0, false); }
From source file:com.google.idea.blaze.base.ideinfo.TargetKey.java
/** Returns a key identifying a plain target */ public static TargetKey forPlainTarget(Label label) { return new TargetKey(label, ImmutableList.of()); }
From source file:com.gradleware.tooling.testing.Combinations.java
/** * Returns all combinations for the given lists. * * @param lists the lists whose elements to combine, must not be null * @return all the combinations, never null */// w w w . j a v a2 s . co m public static ImmutableList<List<Object>> getCombinations(List<?>... lists) { Preconditions.checkNotNull(lists); if (lists.length == 0) { return ImmutableList.of(); } ImmutableMap.Builder<Integer, List<?>> listsMappedByDepth = ImmutableMap.builder(); for (int i = 0; i < lists.length; i++) { listsMappedByDepth.put(i, lists[i]); } return getCombinationsRecursive(listsMappedByDepth.build(), 0, new Object[(lists.length)]); }
From source file:com.opengamma.integration.timeseries.snapshot.EmptyBlackList.java
private EmptyBlackList() { _name = "EMPTY"; _blackList = ImmutableList.of(); }
From source file:org.locationtech.geogig.storage.impl.Blobs.java
public static List<String> readLines(Optional<byte[]> blob) { List<String> lines = ImmutableList.of(); if (blob.isPresent()) { String contents = new String(blob.get(), Charsets.UTF_8); lines = Splitter.on("\n").splitToList(contents); }/*from w w w .ja va 2 s . c o m*/ return lines; }
From source file:org.geogit.api.plumbing.merge.ConflictsReadOp.java
@Override public List<Conflict> call() { final URL repoUrl = getCommandLocator().command(ResolveGeogitDir.class).call(); if (repoUrl == null) { return ImmutableList.of(); } else {//from w ww . ja v a 2 s.c om return getIndex().getDatabase().getConflicts(null, null); } }
From source file:de.metas.ui.web.document.filter.json.JSONStickyDocumentFilter.java
public static final List<JSONStickyDocumentFilter> ofStickyFiltersList(final List<DocumentFilter> filters, final String adLanguage) { if (filters == null || filters.isEmpty()) { return ImmutableList.of(); }//from w w w.j a va 2 s.c om return filters.stream().map(filter -> ofStickyFilterOrNull(filter, adLanguage)) .filter(filter -> filter != null).collect(GuavaCollectors.toImmutableList()); }