public final class RoaringBatchIterator extends java.lang.Object implements BatchIterator
| 构造器和说明 |
|---|
RoaringBatchIterator(RoaringArray highLowContainer) |
| 限定符和类型 | 方法和说明 |
|---|---|
void |
advanceIfNeeded(int target)
If needed, advance as long as the next value is smaller than minval
The advanceIfNeeded method is used for performance reasons, to skip
over unnecessary repeated calls to next.
|
BatchIterator |
clone()
Creates a copy of the iterator.
|
boolean |
hasNext()
Returns true is there are more values to get.
|
int |
nextBatch(int[] buffer)
Writes the next batch of integers onto the buffer,
and returns how many were written.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitasIntIteratorpublic RoaringBatchIterator(RoaringArray highLowContainer)
public int nextBatch(int[] buffer)
BatchIteratornextBatch 在接口中 BatchIteratorbuffer - - the target to write ontopublic boolean hasNext()
BatchIteratorhasNext 在接口中 BatchIteratorpublic BatchIterator clone()
BatchIteratorclone 在接口中 BatchIteratorclone 在类中 java.lang.Objectpublic void advanceIfNeeded(int target)
BatchIterator
int[] buffer = new int[128];
BatchIterator j = // get an iterator
int val = // first value from my other data structure
j.advanceIfNeeded(val);
while ( j.hasNext() ) {
int limit = j.nextBatch(buffer);
for (int i = 0; i < limit; i++) {
if (buffer[i] == val) {
// got it!
// do something here
val = // get next value?
}
}
j.advanceIfNeeded(val);
}
The benefit of calling advanceIfNeeded is that each such call
can be much faster than repeated calls to "next". The underlying
implementation can "skip" over some data.advanceIfNeeded 在接口中 BatchIteratortarget - threshold