@Override public <K extends Exception> boolean batchAccept( int batchSize, AbortingVisitor<? super List<T>, K> visitor) throws K { return delegate().batchAccept(batchSize, visitor); }
/** * Gets the last element in the visitable. * * If a default value of <code>null</code> is wanted, then consider * calling {@link BatchingVisitableView#getLast()} instead. * * @return the last element or <code>defaultElement</code> if the visitable is empty */ @Nullable public T getLast(@Nullable T defaultElement) { return BatchingVisitables.getLast(delegate(), defaultElement); }
/** * Gets the first element in the visitable. * * @return the first element or <code>null</code> if the visitable is empty */ @Nullable public T getFirst() { return BatchingVisitables.getFirst(delegate()); }
public BatchingVisitableView<T> filter(final Predicate<? super T> predicate) { Preconditions.checkNotNull(predicate, "Cannot filter using a null predicate"); return BatchingVisitables.filter(delegate(), predicate); }
/** * Gets the first element in the visitable. * * If a default value of <code>null</code> is wanted, then consider * calling {@link BatchingVisitableView#getFirst()} instead. * * @return the first element or <code>defaultElement</code> if the visitable is empty */ @Nullable public T getFirst(@Nullable T defaultElement) { return BatchingVisitables.getFirst(delegate(), defaultElement); }
/** * Gets the last element in the visitable. * * @return the last element or <code>null</code> if the visitable is empty */ @Nullable public T getLast() { return BatchingVisitables.getLast(delegate()); }
/** * This will return the first maximal element in the visitable. This method * takes a default element and will return that if the visitable is empty. * If the visitable is non-empty it will return the largest value in the * visitable. * <p> * A common way to use this would be to pass <code>null</code> as the * defaultElement and have the ordering throw on null elements so you know * the visitable doesn't have any nulls. */ public T getMin(Ordering<? super T> ordering, @Nullable T defaultElement) { return BatchingVisitables.getMin(delegate(), ordering, defaultElement); }
public <U> BatchingVisitableView<U> transform(Function<? super T, ? extends U> fn) { Preconditions.checkNotNull(fn, "Cannot transform using a null function"); return BatchingVisitables.transform(delegate(), fn); }
/** * This will return the first maximal element in the visitable. This method * takes a default element and will return that if the visitable is empty. * If the visitable is non-empty it will return the largest value in the * visitable. * <p> * A common way to use this would be to pass <code>null</code> as the * defaultElement and have the ordering throw on null elements so you know * the visitable doesn't have any nulls. */ public T getMax(Ordering<? super T> ordering, @Nullable T defaultElement) { return BatchingVisitables.getMax(delegate(), ordering, defaultElement); }
/** * Returns an immutable copy of the elements in this visitable. * * @throws NullPointerException if any elements in the visitable are null */ public ImmutableSet<T> immutableSetCopy() { final ImmutableSet.Builder<T> builder = ImmutableSet.builder(); delegate().batchAccept( BatchingVisitables.DEFAULT_BATCH_SIZE, items -> { builder.addAll(items); return true; }); return builder.build(); }
public BatchingVisitableView<T> limit(long limit) { return BatchingVisitables.limit(delegate(), limit); }
public BatchingVisitableView<T> uniqueOn(Function<T, ?> function) { return BatchingVisitables.uniqueOn(delegate(), function); }
public BatchingVisitableView<T> visitWhile(Predicate<T> condition) { return BatchingVisitables.visitWhile(delegate(), condition); }
public BatchingVisitableView<T> skip(long toSkip) { return BatchingVisitables.skip(delegate(), toSkip); }
public BatchingVisitableView<T> unique() { return BatchingVisitables.unique(delegate()); }
public BatchingVisitableView<T> hintBatchSize(int batchSizeHint) { return BatchingVisitables.hintPageSize(delegate(), batchSizeHint); }
public boolean isEmpty() { return BatchingVisitables.isEmpty(delegate()); }
public boolean isEqual(Iterable<T> it) { return BatchingVisitables.isEqual(delegate(), it); }
public void forEach(int batchSize, final Visitor<T> visitor) { delegate().batchAccept(batchSize, batch -> { for (T item : batch) { visitor.visit(item); } return true; }); }
public BatchingVisitableView<T> concat(BatchingVisitable<? extends T>... inputs) { return BatchingVisitables.concat(Lists.asList(delegate(), inputs)); }