Package com.complexible.common.collect
Class MarkResetSkippingIterator<T>
java.lang.Object
com.complexible.common.collect.AbstractSkippingIterator<T>
com.complexible.common.collect.MarkResetSkippingIterator<T>
- All Implemented Interfaces:
CloseableIterator<T>,Copyable<MarkResetIterator<T>>,MarkResetIterator<T>,PeekingSkippingIterator<T>,ResettableIterator<T>,RestrictedMarkResetIterator<T>,SkippingIterator<T>,com.google.common.collect.PeekingIterator<T>,AutoCloseable,Iterator<T>
public class MarkResetSkippingIterator<T>
extends AbstractSkippingIterator<T>
implements RestrictedMarkResetIterator<T>
Implements the
mark-reset behavior via ResettableIterator.reset() and SkippingIterator.skipTo(Object).
Note: this class does not CloseableIterator.close() the argument iterator.
The class supports restrictions on the underlying iterator, for example, to make sure that it doesn't get out of a specific value range.- Since:
- 8.0
- Author:
- Pavel Klinov
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.complexible.common.base.CloseableIterator
CloseableIterator.AbstractCloseableIterator<T>, CloseableIterator.DelegatingCloseableIterator<T>, CloseableIterator.EmptyCloseableIterator<T> -
Field Summary
Fields inherited from class com.complexible.common.collect.AbstractSkippingIterator
mComparatorFields inherited from interface com.complexible.common.collect.SkippingIterator
UNKNOWN_SIZE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected TReturn the next element to be returned by the iteratorprotected TcomputeSkipTo(T theTarget) Returns the element that this iteration has skipped to ornullif it ran off the end.copy()Create a deep copy of the object which does not share any references with the original.voidCreates a mark from the provided element.protected voidvoidRewinds the position of the iterator to the previously marked element.voidMethods inherited from class com.complexible.common.collect.AbstractSkippingIterator
assertOpen, close, comparator, computeSkipTo, endOfData, estimatedSize, hasNext, isClosed, isLessOrEqualThan, next, peek, remove, reset, resetState, skipTo, skipTo, validateSkipTargetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.complexible.common.base.CloseableIterator
closeMethods inherited from interface java.util.Iterator
forEachRemaining, hasNextMethods inherited from interface com.complexible.common.collect.ResettableIterator
reset
-
Constructor Details
-
MarkResetSkippingIterator
-
-
Method Details
-
restrict
- Specified by:
restrictin interfaceRestrictedMarkResetIterator<T>
-
computeNext
Description copied from class:AbstractSkippingIteratorReturn the next element to be returned by the iterator- Specified by:
computeNextin classAbstractSkippingIterator<T>- Returns:
- the next element
-
computeSkipTo
Description copied from class:AbstractSkippingIteratorReturns the element that this iteration has skipped to ornullif it ran off the end.- Specified by:
computeSkipToin classAbstractSkippingIterator<T>- Parameters:
theTarget- the skipping target- Returns:
- the first element that is greater or equal to the skipping
target, or
nullif it doesn't exist.
-
performReset
protected void performReset()- Specified by:
performResetin classAbstractSkippingIterator<T>
-
mark
Description copied from interface:MarkResetIteratorCreates a mark from the provided element.- Specified by:
markin interfaceMarkResetIterator<T>
-
resetToMark
public void resetToMark()Description copied from interface:MarkResetIteratorRewinds the position of the iterator to the previously marked element.- Specified by:
resetToMarkin interfaceMarkResetIterator<T>
-
copy
Description copied from interface:CopyableCreate a deep copy of the object which does not share any references with the original.
-