Search in sources :

Example 6 with IntConsumer

use of org.roaringbitmap.IntConsumer in project RoaringBitmap by RoaringBitmap.

the class TestMappeableArrayContainer method foreach.

@Test
public void foreach() {
    MappeableContainer ac = newArrayContainer(0, 64);
    ac.forEach((short) 0, new IntConsumer() {

        int expected = 0;

        @Override
        public void accept(int value) {
            assertEquals(value, expected++);
        }
    });
}
Also used : IntConsumer(org.roaringbitmap.IntConsumer) Test(org.junit.Test)

Example 7 with IntConsumer

use of org.roaringbitmap.IntConsumer in project RoaringBitmap by RoaringBitmap.

the class MapBenchmark method testMap.

@BenchmarkMode(Mode.AverageTime)
@Benchmark
public RoaringBitmap testMap(BenchmarkState benchmarkState) {
    final RoaringBitmap answer = new RoaringBitmap();
    benchmarkState.bitmap.forEach(new IntConsumer() {

        @Override
        public void accept(int value) {
            answer.add(inttointmap(value));
        }
    });
    return answer;
}
Also used : RoaringBitmap(org.roaringbitmap.RoaringBitmap) IntConsumer(org.roaringbitmap.IntConsumer) BenchmarkMode(org.openjdk.jmh.annotations.BenchmarkMode) Benchmark(org.openjdk.jmh.annotations.Benchmark)

Aggregations

IntConsumer (org.roaringbitmap.IntConsumer)7 Test (org.junit.Test)5 Benchmark (org.openjdk.jmh.annotations.Benchmark)2 BenchmarkMode (org.openjdk.jmh.annotations.BenchmarkMode)2 LongBuffer (java.nio.LongBuffer)1 BitSet (java.util.BitSet)1 RoaringBitmap (org.roaringbitmap.RoaringBitmap)1