Package com.complexible.common.collect
Interface MarkResetIterator<T>
-
- All Superinterfaces:
java.lang.AutoCloseable
,CloseableIterator<T>
,Copyable<MarkResetIterator<T>>
,java.util.Iterator<T>
,ResettableIterator<T>
- All Known Subinterfaces:
RestrictedMarkResetIterator<T>
- All Known Implementing Classes:
MarkResetSkippingIterator
,SpoolingMarkResetIterator
public interface MarkResetIterator<T> extends CloseableIterator<T>, ResettableIterator<T>, Copyable<MarkResetIterator<T>>
An interface to support multiple passes over a specific part of the iterator's output via mark/reset operations. A mark call records the given element and a resetToMark call rewinds the iterator back to the mark.- 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>
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static <T> MarkResetIterator<T>
empty()
void
mark(T element)
Creates a mark from the provided element.void
resetToMark()
Rewinds the position of the iterator to the previously marked element.-
Methods inherited from interface com.complexible.common.base.CloseableIterator
close
-
Methods inherited from interface com.complexible.common.collect.ResettableIterator
reset
-
-
-
-
Method Detail
-
mark
void mark(T element)
Creates a mark from the provided element. Note: the reset-to-mark behavior is only guaranteed if the mark is a part of the iterator's output. Specific implementations may impose other restrictions, for example, on the mark being ahead or behind the current iterator's position.- Parameters:
element
- the element to serve as a mark
-
resetToMark
void resetToMark()
Rewinds the position of the iterator to the previously marked element.- Throws:
java.util.NoSuchElementException
- if there's no mark
-
empty
static <T> MarkResetIterator<T> empty()
-
-