@Test public void testIterationSmall() { final int[] data = new int[] {1, 2, 3, 4, 5, 6, 100, 101, 102, 103, 104, 105, 50000, 50001, 50002, 1000000, 1000005, 1000007}; RoaringBitmap bitmap = RoaringBitmap.bitmapOf(data); bitmap.runOptimize(); IntIteratorFlyweight iter = new IntIteratorFlyweight(); iter.wrap(bitmap); ReverseIntIteratorFlyweight reverseIter = new ReverseIntIteratorFlyweight(); reverseIter.wrap(bitmap); final List<Integer> intIteratorCopy = asList(iter); final List<Integer> reverseIntIteratorCopy = asList(reverseIter); assertEquals(bitmap.getCardinality(), intIteratorCopy.size()); assertEquals(bitmap.getCardinality(), reverseIntIteratorCopy.size()); assertEquals(Ints.asList(data), intIteratorCopy); assertEquals(Lists.reverse(Ints.asList(data)), reverseIntIteratorCopy); }
public void wrap(RoaringBitmap r) { this.hs = 0; this.pos = 0; this.roaringBitmap = r; this.nextContainer(); }
IntIteratorFlyweight implements PeekableIntIterator { public void wrap(RoaringBitmap r) { this.hs = 0; this.pos = 0; this.roaringBitmap = r; this.nextContainer(); } }
IntIteratorFlyweight implements PeekableIntIterator { public void wrap(RoaringBitmap r) { this.hs = 0; this.pos = 0; this.roaringBitmap = r; this.nextContainer(); } IntIteratorFlyweight();  IntIteratorFlyweight(RoaringBitmap r); }
IntIteratorFlyweight implements PeekableIntIterator { public void wrap(RoaringBitmap r) { this.hs = 0; this.pos = 0; this.roaringBitmap = r; this.nextContainer(); } IntIteratorFlyweight();  IntIteratorFlyweight(RoaringBitmap r); @Override PeekableIntIterator clone(); @Override boolean hasNext(); @Override int next(); void wrap(RoaringBitmap r); @Override void advanceIfNeeded(final int minval); @Override int peekNext(); }
IntIteratorFlyweight implements PeekableIntIterator { public void wrap(RoaringBitmap r) { this.hs = 0; this.pos = 0; this.roaringBitmap = r; this.nextContainer(); } IntIteratorFlyweight();  IntIteratorFlyweight(RoaringBitmap r); @Override PeekableIntIterator clone(); @Override boolean hasNext(); @Override int next(); void wrap(RoaringBitmap r); @Override void advanceIfNeeded(final int minval); @Override int peekNext();  }