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>,java.lang.AutoCloseable,java.util.Iterator<T>
public class MarkResetSkippingIterator<T> extends AbstractSkippingIterator<T> implements RestrictedMarkResetIterator<T>
Implements themark-reset behaviorviaResettableIterator.reset()andSkippingIterator.skipTo(Object). Note: this class does notCloseableIterator.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
mComparator
-
Fields inherited from interface com.complexible.common.collect.SkippingIterator
UNKNOWN_SIZE
-
-
Constructor Summary
Constructors Constructor Description MarkResetSkippingIterator(PeekingSkippingIterator<T> theIterator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected TcomputeNext()Return 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.MarkResetSkippingIterator<T>copy()Create a deep copy of the object which does not share any references with the original.voidmark(T mark)Creates a mark from the provided element.protected voidperformReset()voidresetToMark()Rewinds the position of the iterator to the previously marked element.voidrestrict(java.util.function.Predicate<T> restriction)-
Methods inherited from class com.complexible.common.collect.AbstractSkippingIterator
assertOpen, close, comparator, computeSkipTo, endOfData, estimatedSize, hasNext, isClosed, isLessOrEqualThan, next, peek, remove, reset, resetState, skipTo, skipTo, validateSkipTarget
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.complexible.common.base.CloseableIterator
close
-
Methods inherited from interface com.complexible.common.collect.ResettableIterator
reset
-
-
-
-
Constructor Detail
-
MarkResetSkippingIterator
public MarkResetSkippingIterator(PeekingSkippingIterator<T> theIterator)
-
-
Method Detail
-
restrict
public void restrict(java.util.function.Predicate<T> restriction)
- Specified by:
restrictin interfaceRestrictedMarkResetIterator<T>
-
computeNext
protected 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
protected T computeSkipTo(T theTarget)
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
public void mark(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
public MarkResetSkippingIterator<T> copy()
Description copied from interface:CopyableCreate a deep copy of the object which does not share any references with the original.
-
-