Guava ImmutableList - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava ImmutableList class.

This code example shows how to use the following methods:toArray, size
    public Iterator<String> iterator() {
        return paths.iterator();
    } 
 
    public String[] toArray() {
        return paths.toArray(new String[paths.size()]);
    } 
 
    public BlobPath add(String path) {
        ImmutableList.Builder<String> builder = ImmutableList.builder();
        return new BlobPath(builder.addAll(paths).add(path).build());
    } 
 
    public String buildAsString(String separator) {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < paths.size(); i++) {
            sb.append(paths.get(i));
            if (i < (paths.size() - 1)) {
                sb.append(separator);
            } 
7
CodeRank
This code example shows how to use the following methods:isEmpty, get
        output.println("Done!");
    } 
 
    private static int parseRuns(ImmutableMultimap<String, String> parameters) {
        final ImmutableList<String> runs = parameters.get("runs").asList();
        if (runs.isEmpty()) {
            return 1; 
        } else { 
            try { 
                return Integer.parseInt(runs.get(0));
            } catch (NumberFormatException ignored) {
                return 1; 
            } 
        } 
    } 
} 
7
CodeRank
This code example shows how to use the following methods:size, toArray
    return visitor.visit(this);
  } 
 
  public void applyTo(Binder binder) { 
    binder.withSource(getSource()).bindInterceptor(classMatcher, methodMatcher, 
        interceptors.toArray(new MethodInterceptor[interceptors.size()]));
  } 
} 
6
CodeRank
This code example shows how to use the following methods:isEmpty
    return candidateFiles;
  } 
 
  @Override 
  public final byte[] getSplitPoint() throws IOException {
    if (this.storefiles.isEmpty()) {
      return null; 
    } 
    return StoreUtils.getLargestFile(this.storefiles).getFileSplitPoint(this.kvComparator);
  } 
 
  @Override 
  public final Collection<StoreFile> getFilesForScanOrGet(boolean isGet,
      byte[] startRow, byte[] stopRow) {
    // We cannot provide any useful input and already have the files sorted by seqNum. 
    return getStorefiles(); 
  } 
 
  @Override 
  public int getStoreCompactionPriority() { 
6
CodeRank
This code example shows how to use the following methods:get
    this.args = ImmutableList.copyOf(args);
  } 
 
  @Override 
  public String getShortName() {
    return args.get(0);
  } 
 
  @Override 
  protected ImmutableList<String> getShellCommandInternal(
      ExecutionContext context) {
    return args;
  } 
 
} 
5
CodeRank
This code example shows how to use the following methods:isEmpty
 
    @Override 
    public String toString() {
        StringBuilder b = new StringBuilder();
        b.append("[").append(condition.toString()).append("]");
        if (!orders.isEmpty()) b.append(orders);
        if (hasLimit()) b.append("(").append(getLimit()).append(")");
        b.append(":").append(store);
        return b.toString();
    } 
 
    public static class OrderEntry { 
 
        private final String key;
        private final Order order;
        private final Class<?> datatype;
 
        public OrderEntry(String key, Order order, Class<?> datatype) {
            Preconditions.checkNotNull(key);
            Preconditions.checkNotNull(order);
5
CodeRank
This code example shows how to use the following methods:get
        params,
        new SourcePathResolver(new BuildRuleResolver()), 
        bin,
        EasyMock.createMock(CxxLink.class)); 
    ImmutableList<String> command = binary.getExecutableCommand(filesystem);
    assertTrue(Paths.get(command.get(0)).isAbsolute());
  } 
 
} 
5
CodeRank
This code example shows how to use the following methods:toString
   private static final long serialVersionUID = 1L;
 
   private final ImmutableList<String> messages;
 
   public InvalidChangeBatchException(ImmutableList<String> messages, HttpResponseException cause) {
      super(messages.toString(), cause);
      this.messages = messages;
   } 
 
   public ImmutableList<String> getMessages() {
      return messages;
   } 
} 
5
CodeRank
This code example shows how to use the following methods:iterator
 
        ScopeContext scopeContext = scopes.removeLast();
 
        scopeContext.getEndLabel().accept(methodVisitor, this);
 
        for (Variable variable : scopeContext.getVariables()) {
            new LocalVariableNode(variable, scopeContext.getStartLabel(), scopeContext.getEndLabel()).accept(methodVisitor, this);
        } 
 
        variableSlots.keySet().removeAll(scopeContext.getVariables());
    } 
 
    public int getVariableSlot(Variable variable)
    { 
        Integer slot = variableSlots.get(variable);
        checkArgument(slot != null, "Variable '%s' has not been assigned a slot", variable);
        return slot;
    } 
 
    public boolean updateLineNumber(int lineNumber)
5
CodeRank
This code example shows how to use the following methods:size
    ImmutableList.Builder<Step> stepsBuilder = ImmutableList.builder();
    CopyNativeLibraries.copyNativeLibrary( 
        Paths.get(sourceDir), Paths.get(destinationDir), cpuFilters, stepsBuilder);
    ImmutableList<Step> steps = stepsBuilder.build();
 
    assertEquals(steps.size(), expectedCommandDescriptions.size());
    ExecutionContext context = TestExecutionContext.newInstance();
 
    for (int i = 0; i < steps.size(); ++i) {
      String description = steps.get(i).getDescription(context);
      assertEquals(expectedCommandDescriptions.get(i), description);
    } 
  } 
} 
5
CodeRank
See Code Examples for Guava ImmutableList Methods: