Interface Internals.TailSpliterator<T>

Type Parameters:
T - the type of elements returned by this spliterator
All Superinterfaces:
Spliterator<T>
All Known Implementing Classes:
HeadTailSpliterator, PairSpliterator.PSOfRef, PrependSpliterator, TailConcatSpliterator
Enclosing interface:
Internals

public static interface Internals.TailSpliterator<T> extends Spliterator<T>
A spliterator which may perform tail-stream optimization
  • Method Details

    • tryAdvanceOrTail

      Spliterator<T> tryAdvanceOrTail(Consumer<? super T> action)
      Either advances by one element feeding it to consumer and returns this or returns tail spliterator (this spliterator becomes invalid and tail must be used instead) or returns null if traversal finished.
      Parameters:
      action - to feed the next element into
      Returns:
      tail spliterator, this or null
    • forEachOrTail

      Spliterator<T> forEachOrTail(Consumer<? super T> action)
      Traverses this spliterator and returns null if traversal is completed or tail spliterator if it must be used for further traversal.
      Parameters:
      action - to feed the elements into
      Returns:
      tail spliterator or null (never returns this)
    • tryAdvanceWithTail

      static <T> Spliterator<T> tryAdvanceWithTail(Spliterator<T> target, Consumer<? super T> action)
    • forEachWithTail

      static <T> void forEachWithTail(Spliterator<T> target, Consumer<? super T> action)