public abstract class PrefetchingIterator<T> extends Object implements Iterator<T>
hasNext()
method will look up the next object and
cache it. The cached object is then set to null
in next()
.
So you only have to implement one method, fetchNextOrNull
which
returns null
when the iteration has reached the end, and you're done.Constructor and Description |
---|
PrefetchingIterator() |
public boolean hasNext()
public T peek()
next()
without
actually advancing the iteratorpublic T next()
hasNext()
to try to fetch the next item and returns it
if found, otherwise it throws a NoSuchElementException
.next
in interface Iterator<T>
NoSuchElementException
if there's no more items to return.Copyright © 2002–2014 The Neo4j Graph Database Project. All rights reserved.