Class StreamSpliterator<T>
java.lang.Object
java.util.Spliterators.AbstractSpliterator<T>
org.axonframework.eventsourcing.eventstore.StreamSpliterator<T>
- Type Parameters:
T- The generic type serves by thisSpliterators.AbstractSpliteratorimplementation.
- All Implemented Interfaces:
Spliterator<T>
An
Spliterators.AbstractSpliterator implementation used internally to feed a Stream
through the StreamSupport.stream(Spliterator, boolean) operation.- Since:
- 3.0.0
- Author:
- Rene de Waele
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>> -
Field Summary
Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.Spliterators.AbstractSpliterator
characteristics, estimateSize, trySplitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Spliterator
forEachRemaining, getComparator, getExactSizeIfKnown, hasCharacteristics
-
Constructor Details
-
StreamSpliterator
public StreamSpliterator(@Nonnull Function<T, List<? extends T>> fetchFunction, @Nonnull Predicate<List<? extends T>> finalFetchPredicate) Constructs aStreamSpliteratorusing the givenfetchFunctionandfinalFetchPredicate.Both lambdas are used in the
tryAdvance(Consumer)operation of this spliterator. ThefetchFunctionretrieves collections of typeT, which are fed to theactionoftryAdvance(Consumer).The
finalFetchPredicatesignals when thefetchFunctionhas done its last fetch operation. Whenever thisPredicatereturnstrue,tryAdvance(Consumer)will returnfalse, to signal the stream is done.- Parameters:
fetchFunction- Lambda used to fetch new entries of typeTto iteratively provide to theactionoftryAdvance(Consumer).finalFetchPredicate- Lambda dictating when thefetchFunctionhas done its last fetch.
-
-
Method Details
-
tryAdvance
-