public final class MoreSpliterators
extends java.lang.Object
Spliterators| Constructor and Description |
|---|
MoreSpliterators() |
| Modifier and Type | Method and Description |
|---|---|
static <T> java.util.Spliterator<T> |
ofPaged(PageIterator<T> pageIterator)
Returns a spliterator which allows traversing over elements provided via a paging protocol
|
static <T,A> java.util.Spliterator<T> |
shortCircuit(java.util.Spliterator<T> spliterator,
java.util.function.BiFunction<java.util.Optional<A>,? super T,A> accumulator,
java.util.function.Predicate<A> completedPredicate)
Returns a spliterator which allows stopping traversal when the previously traversed elements meet criteria
specified by a predicate.
|
public static <T,A> java.util.Spliterator<T> shortCircuit(java.util.Spliterator<T> spliterator,
java.util.function.BiFunction<java.util.Optional<A>,? super T,A> accumulator,
java.util.function.Predicate<A> completedPredicate)
The returned spliterator will have a sub-set of the characteristics of the original
T - Representation supplied by the provided spliteratorA - Representation of accumulated data from previously traversed rowsspliterator - Original spliterator which traverses elements until completeaccumulator - Function which accepts a representation of previously traversed elements and the current element. If
no elements were previously traversed, the provided previous value will be an empty Optional. Must
return non-nullcompletedPredicate - Predicate defining the conditions under which to cease traversal of the spliteratorpublic static <T> java.util.Spliterator<T> ofPaged(PageIterator<T> pageIterator)
T - Representation of a single element in the sequencepageIterator - A source-specific implementation which handles the protocol for reading a sequence of paged data