java.lang.Object
org.apache.jena.atlas.iterator.IteratorWithHistory<T>
- All Implemented Interfaces:
Iterator<T>,IteratorCloseable<T>,Closeable
Remembers the last N yields.
See also
IteratorWithBuffer, for an iterator that looks ahead to what it will yield.
History is retained at the end of iterator.
"Close" releases the history.- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intReturn the current size of the history.getPrevious(int idx) return the previous i'th element returned by next().booleanhasNext()next()Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining, remove
-
Constructor Details
-
IteratorWithHistory
-
-
Method Details
-
hasNext
public boolean hasNext() -
next
-
getPrevious
return the previous i'th element returned by next(). 0 means last call of next. History is retained after the end of iteration.- Returns:
- Element or null for no such element (that is for haven't yielded that many elements).
- Throws:
IndexOutOfBoundsException- if index is negative.
-
currentSize
public int currentSize()Return the current size of the history. This can be used to tell the difference between an iterator returning null and an iterator that is just short. -
close
public void close()
-