Module java.base
Package java.util

Class Spliterators.AbstractSpliterator<T>

java.lang.Object
java.util.Spliterators.AbstractSpliterator<T>
Type Parameters:
T - the type of elements returned by this Spliterator
All Implemented Interfaces:
Spliterator<T>
Enclosing class:
Spliterators

public abstract static class Spliterators.AbstractSpliterator<T> extends Object implements Spliterator<T>
An abstract Spliterator that implements trySplit to permit limited parallelism.

An extending class need only implement tryAdvance. The extending class should override forEachRemaining if it can provide a more performant implementation.

API Note:
This class is a useful aid for creating a spliterator when it is not possible or difficult to efficiently partition elements in a manner allowing balanced parallel computation.

An alternative to using this class, that also permits limited parallelism, is to create a spliterator from an iterator (see Spliterators.spliterator(Iterator, long, int). Depending on the circumstances using an iterator may be easier or more convenient than extending this class, such as when there is already an iterator available to use.

Since:
1.8
See Also: