metamx / bytebuffer-collections

ByteBuffer collection classes for java and jvm-based languages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

wrong result with WrappedImmutableConciseBitmap#difference

lushuifeng opened this issue · comments

here is the sample code, the result should be [0,2] which is not

    BitmapFactory bitmapFactory = new ConciseBitmapFactory();
    MutableBitmap bitmap = bitmapFactory.makeEmptyMutableBitmap();
    for (int i = 0; i < 3; ++i) {
      bitmap.add(i);
    }
    MutableBitmap diff = bitmapFactory.makeEmptyMutableBitmap();
    diff.add(1);
    ImmutableBitmap result = bitmapFactory.makeImmutableBitmap(bitmap).difference(bitmapFactory.makeImmutableBitmap(diff));
    System.out.println(result);

the result is correct with using RoaringBitmapFactory or MutableBitmap

    BitmapFactory bitmapFactory = new ConciseBitmapFactory();
    MutableBitmap bitmap = bitmapFactory.makeEmptyMutableBitmap();
    for (int i = 0; i < 3; ++i) {
      bitmap.add(i);
    }
    MutableBitmap diff = bitmapFactory.makeEmptyMutableBitmap();
    diff.add(1);
    ImmutableBitmap result = bitmap.difference(diff);
    System.out.println(result);

May I create a pr to fix this? thanks