List of usage examples for com.google.common.collect ImmutableList isEmpty
boolean isEmpty();
From source file:org.immutables.generator.processor.RunParser.java
public static void main(String... args) { Parser templateParser = Parboiled.createParser(Parser.class); ParsingResult<Object> result = new ReportingParseRunner<>(templateParser.Unit()).run(input2); ImmutableList<Object> copy = ImmutableList.copyOf(result.valueStack.iterator()); if (!copy.isEmpty()) { Unit unit = (Unit) copy.get(0);/* w w w . jav a 2 s. c o m*/ Unit balance = Balancing.balance(unit); System.out.println(balance); } if (result.hasErrors()) { System.err.println(ErrorUtils.printParseErrors(result.parseErrors)); } // System.out.println(ParseTreeUtils.printNodeTree(result)); }
From source file:com.mycompany.mavenproject3.List.java
public static Cons makeCons(ImmutableList<Sexpression> list) { if (list.isEmpty()) { return new Nil(); } else if (list.size() == 1) { return new Cons(list.get(0), new Nil()); } else {//from w ww. j a v a 2 s . c o m Sexpression head = list.get(0); ImmutableList<Sexpression> tail = list.subList(1, list.size() - 1); return new Cons(head, makeCons(tail)); } }
From source file:org.caleydo.view.bicluster.sorting.ConcatedList.java
public static <T> List<T> concat(ImmutableList<T> a, ImmutableList<T> b) { if (a.isEmpty()) return b; if (b.isEmpty()) return a; return new ConcatedList<>(a, b); }
From source file:com.google.devtools.build.lib.skyframe.AbstractFileSymlinkExceptionUniquenessValue.java
protected static SkyKey key(SkyFunctionName functionName, ImmutableList<RootedPath> chain) { Preconditions.checkState(!chain.isEmpty()); return new SkyKey(functionName, canonicalize(chain)); }
From source file:com.google.devtools.build.lib.skyframe.FileSymlinkCycleUniquenessValue.java
static SkyKey key(ImmutableList<RootedPath> cycle) { Preconditions.checkState(!cycle.isEmpty()); return new SkyKey(SkyFunctions.FILE_SYMLINK_CYCLE_UNIQUENESS, canonicalize(cycle)); }
From source file:com.google.devtools.build.lib.skyframe.ChainUniquenessUtils.java
/** * Create a SkyKey for {@code functionName} with a canonicalized representation of the cycle * specified by {@code chain} as the argument. {@code chain} must be non-empty. *///from w w w. j a v a2 s . c o m static SkyKey key(SkyFunctionName functionName, ImmutableList<? extends Object> chain) { Preconditions.checkState(!chain.isEmpty()); return SkyKey.create(functionName, canonicalize(chain)); }
From source file:com.mycompany.mavenproject3.Interpreter.java
public static Cons makeListHelp(ImmutableList<Sexpression> list) { // ImmutableList<Sexpression> list = ImmutableList.copyOf(sexpressions); if (list.isEmpty()) { return new Nil(); }/*from w w w. j a v a 2 s .co m*/ if (list.size() == 1) { return new Cons(list.get(0), new Nil()); } else { return new Cons(list.get(0), makeListHelp(list.subList(1, list.size() - 1))); } }
From source file:com.google.devtools.build.importdeps.ResolutionFailureChain.java
public static ResolutionFailureChain createWithParent(ClassInfo resolutionStartClass, ImmutableList<ResolutionFailureChain> parentChains) { Preconditions.checkArgument(!parentChains.isEmpty(), "The parentChains cannot be empty."); return new AutoValue_ResolutionFailureChain( parentChains.stream().flatMap(chain -> chain.missingClasses().stream()).sorted().distinct() .collect(ImmutableList.toImmutableList()), resolutionStartClass, parentChains); }
From source file:org.eigenbase.relopt.RelOptPredicateList.java
public static RelOptPredicateList of(Iterable<RexNode> pulledUpPredicates) { ImmutableList<RexNode> pulledUpPredicatesList = ImmutableList.copyOf(pulledUpPredicates); if (pulledUpPredicatesList.isEmpty()) { return EMPTY; }/*from w w w .j a v a2 s. c o m*/ return new RelOptPredicateList(pulledUpPredicatesList, EMPTY_LIST, EMPTY_LIST); }
From source file:com.github.imasahiro.stringformatter.processor.specifier.StringFormatConversionType.java
private static String convertToFormattableFlags(Set<FormatFlag> flags) { ImmutableList.Builder<Integer> flagBuilder = ImmutableList.builder(); if (flags.contains(FormatFlag.UPPER_CASE)) { flagBuilder.add(FormattableFlags.UPPERCASE); }// w w w . java 2s. com if (flags.contains(FormatFlag.SHARP)) { flagBuilder.add(FormattableFlags.ALTERNATE); } if (flags.contains(FormatFlag.MINUS)) { flagBuilder.add(FormattableFlags.LEFT_JUSTIFY); } ImmutableList<Integer> formatterFlags = flagBuilder.build(); if (formatterFlags.isEmpty()) { formatterFlags = ImmutableList.of(0); } return Joiner.on("|").join(formatterFlags); }