Class PrefetchIterator<K>
- java.lang.Object
-
- org.apache.jackrabbit.oak.jcr.query.PrefetchIterator<K>
-
- Type Parameters:
K
- the iterator data type
- All Implemented Interfaces:
java.util.Iterator<K>
public class PrefetchIterator<K> extends java.lang.Object implements java.util.Iterator<K>
An iterator that pre-fetches a number of items in order to calculate the size of the result if possible. This iterator loads at least a number of items, and then tries to load some more items until the timeout is reached or the maximum number of entries are read.Prefetching is only done when size() is called.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PrefetchIterator.PrefetchOptions
The options to use for prefetching.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
hasNext()
K
next()
void
remove()
long
size()
Get the size if known.
-
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<K>
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator<K>
-
size
public long size()
Get the size if known. This call might pre-fetch data. The returned value is unknown if the actual size is larger than the number of pre-fetched elements, unless the end of the iterator has been reached already.- Returns:
- the size, or -1 if unknown
-
-