Class ConstantMemoryContainerAppender<T extends BitmapDataProvider & AppendableStorage<Container>>

  • All Implemented Interfaces:
    Supplier<T>, RoaringBitmapWriter<T>

    public class ConstantMemoryContainerAppender<T extends BitmapDataProvider & AppendableStorage<Container>>
    extends Object
    implements RoaringBitmapWriter<T>
    This class can be used to write quickly values to a bitmap. The values are expected to be (increasing) sorted order. Values are first written to a temporary internal buffer, but the underlying bitmap can forcefully synchronize by calling "flush" (although calling flush to often would defeat the performance purpose of this class). The main use case for an ConstantMemoryContainerAppender is to get bitmaps quickly. You should benchmark your particular use case to see if it helps.
     
    
           //...
    
    
           RoaringBitmapWriter<RoaringBitmap> writer =
                RoaringBitmapWriter.writer().constantMemory().get();
           for (int i :....) {
             writer.add(i);
           }
           writer.flush(); // important