Spliterator
An object for traversing and partitioning elements of a source. The source could be an array, a Collection, an IO channel, or a generator function.
Spliterators support sequential traversal (tryAdvance, forEachRemaining) and parallel decomposition (trySplit). They report characteristics about their structure and elements.
Type Parameters
the type of elements returned by this Spliterator
Inheritors
Types
A Spliterator specialized for Double values.
A Spliterator specialized for Int values.
A Spliterator specialized for Long values.
Base interface for Spliterators specialized for primitive values.
Functions
Returns a set of characteristics of this Spliterator and its elements. The result is represented as ORed values from the constants defined in the companion object (ORDERED, DISTINCT, etc.).
Returns an estimate of the number of elements that would be encountered by a forEachRemaining traversal, or Long.MAX_VALUE if infinite, unknown, or too expensive to compute.
Performs the given action for each remaining element, sequentially, until all elements have been processed or the action throws an exception. If this Spliterator is ORDERED, actions are performed in encounter order. Exceptions thrown by the action are relayed to the caller.
If SORTED by a Comparator, returns that Comparator. If SORTED in natural order, returns null. Otherwise (not SORTED), throws IllegalStateException.
Convenience method returning estimateSize if SIZED, else -1L.
Returns true if this Spliterator's characteristics contain all of the given characteristics.
If a remaining element exists: performs the given action on it, returning true; else returns false. If this Spliterator is ORDERED, the action is performed on the next element in encounter order. Exceptions thrown by the action are relayed to the caller.
If this spliterator can be partitioned, returns a Spliterator covering elements that will, upon return, not be covered by this Spliterator.