Class ContainerAppender<C extends WordStorage<C>,​T extends BitmapDataProvider & AppendableStorage<C>>

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

    public class ContainerAppender<C extends WordStorage<C>,​T extends BitmapDataProvider & AppendableStorage<C>>
    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 ContainerAppender is to get bitmaps quickly. You should benchmark your particular use case to see if it helps.
     
    
         //...
    
         RoaringBitmapWriter<RoaringBitmap> writer =
            RoaringBitmapWriter.writer().get();
         for (int i :....) {
           writer.add(i);
         }
         writer.flush(); // important
     
     
    • Method Detail

      • add

        public void add​(int value)
        Adds the value to the underlying bitmap. The data might be added to a temporary buffer. You should call "flush" when you are done.
        Specified by:
        add in interface RoaringBitmapWriter<C extends WordStorage<C>>
        Parameters:
        value - the value to add.
      • add

        public void add​(long min,
                        long max)
        Description copied from interface: RoaringBitmapWriter
        Add a range to the bitmap
        Specified by:
        add in interface RoaringBitmapWriter<C extends WordStorage<C>>
        Parameters:
        min - the inclusive min value
        max - the exclusive max value