Interface Spliterator<T>
public interface Spliterator<T>
A source of elements that hands them out one at a time, which is what
java.util.stream.StreamSupport makes a stream of.
Streams here are sequential, so nothing splits one: trySplit may
answer null, and the ones this library makes always do.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe source may be changed safely while it is read.static final intNo two elements are equal.static final intThe source cannot be changed.static final intNo element is null.static final intThe elements have a defined encounter order.static final intestimateSize()is exact.static final intThe elements are in the ordergetComparator()gives.static final intThe parts a split makes are sized too. -
Method Summary
Modifier and TypeMethodDescriptionintThe characteristics of this source, as a set of the bits declared here.longHow many elements remain,Long.MAX_VALUEwhen that is not known.default voidforEachRemaining(Consumer<? super T> action) Hands every remaining element toaction, in order.default Comparator<? super T> The order of aSORTEDsource, null for the natural order.default longestimateSize()when the source isSIZED, -1 otherwise.default booleanhasCharacteristics(int characteristics) Whether every bit ofcharacteristicsis one of this source's.booleantryAdvance(Consumer<? super T> action) Hands the next element toactionand answers true, or answers false when there is none.trySplit()A part of the elements to be read separately, or null when this source does not split.
-
Field Details
-
ORDERED
static final int ORDEREDThe elements have a defined encounter order.- See Also:
-
DISTINCT
static final int DISTINCTNo two elements are equal.- See Also:
-
SORTED
-
SIZED
-
NONNULL
static final int NONNULLNo element is null.- See Also:
-
IMMUTABLE
static final int IMMUTABLEThe source cannot be changed.- See Also:
-
CONCURRENT
static final int CONCURRENTThe source may be changed safely while it is read.- See Also:
-
SUBSIZED
static final int SUBSIZEDThe parts a split makes are sized too.- See Also:
-
-
Method Details
-
tryAdvance
-
forEachRemaining
-
trySplit
Spliterator<T> trySplit()A part of the elements to be read separately, or null when this source does not split. -
estimateSize
long estimateSize()How many elements remain,Long.MAX_VALUEwhen that is not known. -
getExactSizeIfKnown
default long getExactSizeIfKnown()estimateSize()when the source isSIZED, -1 otherwise. -
characteristics
int characteristics()The characteristics of this source, as a set of the bits declared here. -
hasCharacteristics
default boolean hasCharacteristics(int characteristics) Whether every bit ofcharacteristicsis one of this source's. -
getComparator
The order of a
SORTEDsource, null for the natural order.Throws
IllegalStateException: when the source is not sorted
-