Class SinglePrefetchIterator<T>
java.lang.Object
org.aksw.commons.collections.SinglePrefetchIterator<T>
- Type Parameters:
T-
- All Implemented Interfaces:
Closeable, AutoCloseable, Iterator<T>
- Direct Known Subclasses:
FilteringIterator, SetIterator, WindowedSorterIterator
An abstract base class for iterating over containers of unknown size. This
works by prefetching junks of the container: Whenever the iterator reaches
the end of a chunk, the method "myPrefetch" is called.
Note that once the iterator is finished (myPrefetch returned null),
myPrefetch will never be called again. This means, that if myPrefetch is
called, the iterator hasn't reached its end yet.
- Author:
- raven_arkadon
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()An iterator must always free all resources once done with iteration.current()protected voidprotected Tfinish()booleanhasNext()next()protected abstract Tprefetch()final voidremove()protected booleanprotected booleanprotected booleanWhether the next call to next() or hasNext() will trigger loading the next elementMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterator
forEachRemaining
-
Constructor Details
-
SinglePrefetchIterator
protected SinglePrefetchIterator()
-
-
Method Details
-
prefetch
-
finish
-
hasNext
-
next
-
current
-
willAdvance
protected boolean willAdvance()Whether the next call to next() or hasNext() will trigger loading the next element -
wasNextCalled
protected boolean wasNextCalled() -
wasHasNextCalled
protected boolean wasHasNextCalled() -
close
public void close()An iterator must always free all resources once done with iteration. However, if iteration is aborted, this method should be called.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
remove
-
doRemove
-