Skip to content

Commit

Permalink
implement workaround for BatchIterator interface change
Browse files Browse the repository at this point in the history
  • Loading branch information
xvrl committed Sep 18, 2023
1 parent b404563 commit 8e68427
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@

import com.google.common.base.Preconditions;
import org.roaringbitmap.BatchIterator;
import org.roaringbitmap.IntIterator;
import org.roaringbitmap.PeekableIntIterator;

public final class BatchIteratorAdapter implements BatchIterator
{
private final IntIterator iterator;
private final PeekableIntIterator iterator;

public BatchIteratorAdapter(IntIterator iterator)
public BatchIteratorAdapter(PeekableIntIterator iterator)
{
this.iterator = Preconditions.checkNotNull(iterator, "iterator");
}
Expand All @@ -49,6 +49,12 @@ public boolean hasNext()
return iterator.hasNext();
}

@Override
public void advanceIfNeeded(int target)
{
iterator.advanceIfNeeded(target);
}

@Override
public BatchIterator clone()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ default PeekableIntIterator peekableIterator()
*/
default BatchIterator batchIterator()
{
return new BatchIteratorAdapter(iterator());
return new BatchIteratorAdapter(peekableIterator());
}

/**
Expand Down

0 comments on commit 8e68427

Please sign in to comment.