org.aksw.commons.collections
Class SinglePrefetchIterator<T>
java.lang.Object
org.aksw.commons.collections.SinglePrefetchIterator<T>
- Type Parameters:
T -
- All Implemented Interfaces:
- Iterator<T>
- Direct Known Subclasses:
- WindowedSorterIterator
public abstract class SinglePrefetchIterator<T>
- extends Object
- implements Iterator<T>
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
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SinglePrefetchIterator
protected SinglePrefetchIterator()
prefetch
protected abstract T prefetch()
throws Exception
- Throws:
Exception
finish
protected T finish()
hasNext
public boolean hasNext()
- Specified by:
hasNext in interface Iterator<T>
next
public T next()
- Specified by:
next in interface Iterator<T>
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.
remove
public void remove()
- Specified by:
remove in interface Iterator<T>
Copyright © 2012. All Rights Reserved.