- 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
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.sympho.modular_commands.utils.SmartIterator
SmartIterator.Detachable<E extends @NonNull Object>, SmartIterator.ListIterator<E extends @NonNull Object>, SmartIterator.Wrapper<E extends @NonNull Object> -
Field Summary
Fields inherited from interface dev.sympho.modular_commands.utils.SmartIterator
NO_MORE_ELEMENTS_ERROR -
Method Summary
Modifier and TypeMethodDescriptiontoFlux()Returns a flux that issues the remaining elements to be traversed by this iterator.Returns an iterator that iterates over the remaining elements to be traversed by this iterator.Returns a spliterator that iterates over the remaining elements to be traversed by this iterator.toStream()Returns a stream that contains over the remaining elements to be traversed by this iterator.Methods inherited from interface java.util.Iterator
forEachRemaining, next, removeMethods inherited from interface dev.sympho.modular_commands.utils.SmartIterator
hasNext, peek
-
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:
toSpliteratorin interfaceSmartIterator<E extends @NonNull Object>- Returns:
- The spliterator.
-
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:
toStreamin interfaceSmartIterator<E extends @NonNull Object>- Returns:
- The stream.
-
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:
toFluxin interfaceSmartIterator<E extends @NonNull Object>- Returns:
- The flux.
-