Interface SmartIterator.Detachable<E extends @NonNull Object>

Type Parameters:
E - The element type.
All Superinterfaces:
Iterator<E>, SmartIterator<E>
All Known Subinterfaces:
StringSplitter.Async.Iterator, StringSplitter.Iterator
All Known Implementing Classes:
SmartIterator.ListIterator
Enclosing interface:
SmartIterator<E extends @NonNull Object>

public static interface SmartIterator.Detachable<E extends @NonNull Object> extends SmartIterator<E>
A smart iterator that, when creating other iterators/streams/fluxes/etc from its current state, makes them detached, so that they are independent of the future state of the original iterator and vice-versa.
Since:
1.0
  • Method Details

    • toIterator

      Returns an iterator that iterates over the remaining elements to be traversed by this iterator.

      The returned iterator is guaranteed to be detached from this iterator. In other words, they are completely independent of each other and may both be used separately.

      Returns:
      The iterator.
    • toSpliterator

      Spliterator<E> toSpliterator()
      Returns a spliterator that iterates over the remaining elements to be traversed by this iterator.

      The returned spliterator is guaranteed to be detached from this iterator. In other words, they are completely independent of each other and may both be used separately.

      Specified by:
      toSpliterator in interface SmartIterator<E extends @NonNull Object>
      Returns:
      The spliterator.
    • toStream

      Stream<E> toStream()
      Returns a stream that contains over the remaining elements to be traversed by this iterator.

      The returned stream is guaranteed to be detached from this iterator. In other words, they are completely independent of each other and may both be used separately.

      Specified by:
      toStream in interface SmartIterator<E extends @NonNull Object>
      Returns:
      The stream.
    • toFlux

      Flux<E> toFlux()
      Returns a flux that issues the remaining elements to be traversed by this iterator.

      The returned flux is guaranteed to be detached from this iterator. In other words, they are completely independent of each other and may both be used separately.

      Specified by:
      toFlux in interface SmartIterator<E extends @NonNull Object>
      Returns:
      The flux.