Class SpoolingMarkResetIterator<T extends Copyable<T>>

java.lang.Object
com.complexible.common.collect.SpoolingMarkResetIterator<T>
All Implemented Interfaces:
CloseableIterator<T>, Copyable<MarkResetIterator<T>>, MarkResetIterator<T>, ResettableIterator<T>, RestrictedMarkResetIterator<T>, AutoCloseable, Iterator<T>

public class SpoolingMarkResetIterator<T extends Copyable<T>> extends Object implements RestrictedMarkResetIterator<T>
A wrapper around MarkResetSkippingIterator with bounded spooling: once the mark(T) method has been called, the iterator will start spooling until one of the following conditions occurs: 1) the spooling threshold is reached, in which case the iterator switches to the skipping-based mark-reset behavior. 2) the resetToMark() method is called, in which case the iterator starts returning the spooled elements. Note: this implementation should only be used when marking the last returned element. Otherwise it is not able to retrieve the elements that are between the mark and the current position after calling the resetToMark() method. Similarly to MarkResetSkippingIterator this implementation does not close the base iterator.
Since:
8.0
Author:
Pavel Klinov