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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The source may be changed safely while it is read.
    static final int
    No two elements are equal.
    static final int
    The source cannot be changed.
    static final int
    No element is null.
    static final int
    The elements have a defined encounter order.
    static final int
    estimateSize() is exact.
    static final int
    The elements are in the order getComparator() gives.
    static final int
    The parts a split makes are sized too.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    The characteristics of this source, as a set of the bits declared here.
    long
    How many elements remain, Long.MAX_VALUE when that is not known.
    default void
    forEachRemaining(Consumer<? super T> action)
    Hands every remaining element to action, in order.
    default Comparator<? super T>
    The order of a SORTED source, null for the natural order.
    default long
    estimateSize() when the source is SIZED, -1 otherwise.
    default boolean
    hasCharacteristics(int characteristics)
    Whether every bit of characteristics is one of this source's.
    boolean
    tryAdvance(Consumer<? super T> action)
    Hands the next element to action and answers true, or answers false when there is none.
    A part of the elements to be read separately, or null when this source does not split.
  • Field Details

  • Method Details

    • tryAdvance

      boolean tryAdvance(Consumer<? super T> action)
      Hands the next element to action and answers true, or answers false when there is none.
    • forEachRemaining

      default void forEachRemaining(Consumer<? super T> action)
      Hands every remaining element to action, in order.
    • 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_VALUE when that is not known.
    • getExactSizeIfKnown

      default long getExactSizeIfKnown()
      estimateSize() when the source is SIZED, -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 of characteristics is one of this source's.
    • getComparator

      default Comparator<? super T> getComparator()

      The order of a SORTED source, null for the natural order.

      Throws
      • IllegalStateException: when the source is not sorted