Interface ImmutableLongBitmapDataProvider

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      boolean contains​(long x)
      Checks whether the value in included, which is equivalent to checking if the corresponding bit is set (get in BitSet class).
      long first()
      Get the first (smallest) integer in this RoaringBitmap, that is, return the minimum of the set.
      void forEach​(LongConsumer lc)
      Visit all values in the bitmap and pass them to the consumer.
      long getLongCardinality()
      Returns the number of distinct integers added to the bitmap (e.g., number of bits set).
      LongIterator getLongIterator()
      For better performance, consider the Use the forEach method.
      long getLongSizeInBytes()
      Estimate of the memory usage of this data structure.
      LongIterator getReverseLongIterator()  
      int getSizeInBytes()
      Estimate of the memory usage of this data structure.
      boolean isEmpty()
      Checks whether the bitmap is empty.
      long last()
      Get the last (largest) integer in this RoaringBitmap, that is, return the maximum of the set.
      ImmutableLongBitmapDataProvider limit​(long x)
      Create a new bitmap of the same class, containing at most maxcardinality integers.
      long rankLong​(long x)
      Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).
      default java.util.stream.LongStream reverseStream()  
      long select​(long j)
      Return the jth value stored in this bitmap.
      void serialize​(java.io.DataOutput out)
      Serialize this bitmap.
      long serializedSizeInBytes()
      Report the number of bytes required to serialize this bitmap.
      default java.util.stream.LongStream stream()  
      long[] toArray()
      Return the set values as an array.
    • Method Detail

      • contains

        boolean contains​(long x)
        Checks whether the value in included, which is equivalent to checking if the corresponding bit is set (get in BitSet class).
        Parameters:
        x - long value
        Returns:
        whether the long value is included.
      • getLongCardinality

        long getLongCardinality()
        Returns the number of distinct integers added to the bitmap (e.g., number of bits set). This returns a full 64-bit result.
        Returns:
        the cardinality
      • forEach

        void forEach​(LongConsumer lc)
        Visit all values in the bitmap and pass them to the consumer. * Usage:
         
          bitmap.forEach(new LongConsumer() {
        
            {@literal @}Override
            public void accept(long value) {
              // do something here
              
            }});
           
         }
         
        Parameters:
        lc - the consumer
      • getLongIterator

        LongIterator getLongIterator()
        For better performance, consider the Use the forEach method.
        Returns:
        a custom iterator over set bits, the bits are traversed in ascending sorted order
      • getReverseLongIterator

        LongIterator getReverseLongIterator()
        Returns:
        a custom iterator over set bits, the bits are traversed in descending sorted order
      • stream

        default java.util.stream.LongStream stream()
        Returns:
        an Ordered, Distinct, Sorted and Sized IntStream in ascending order
      • reverseStream

        default java.util.stream.LongStream reverseStream()
        Returns:
        an Ordered, Distinct and Sized IntStream providing bits in descending sorted order
      • getSizeInBytes

        int getSizeInBytes()
        Estimate of the memory usage of this data structure. Internally, this is computed as a 64-bit counter.
        Returns:
        estimated memory usage.
      • getLongSizeInBytes

        long getLongSizeInBytes()
        Estimate of the memory usage of this data structure. Provides full 64-bit number.
        Returns:
        estimated memory usage.
      • isEmpty

        boolean isEmpty()
        Checks whether the bitmap is empty.
        Returns:
        true if this bitmap contains no set bit
      • limit

        ImmutableLongBitmapDataProvider limit​(long x)
        Create a new bitmap of the same class, containing at most maxcardinality integers.
        Parameters:
        x - maximal cardinality
        Returns:
        a new bitmap with cardinality no more than maxcardinality
      • rankLong

        long rankLong​(long x)
        Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()). The value is a full 64-bit value.
        Parameters:
        x - upper limit
        Returns:
        the rank
      • select

        long select​(long j)
        Return the jth value stored in this bitmap.
        Parameters:
        j - index of the value
        Returns:
        the value
      • first

        long first()
        Get the first (smallest) integer in this RoaringBitmap, that is, return the minimum of the set.
        Returns:
        the first (smallest) integer
        Throws:
        java.util.NoSuchElementException - if empty
      • last

        long last()
        Get the last (largest) integer in this RoaringBitmap, that is, return the maximum of the set.
        Returns:
        the last (largest) integer
        Throws:
        java.util.NoSuchElementException - if empty
      • serialize

        void serialize​(java.io.DataOutput out)
                throws java.io.IOException
        Serialize this bitmap. The current bitmap is not modified.
        Parameters:
        out - the DataOutput stream
        Throws:
        java.io.IOException - Signals that an I/O exception has occurred.
      • serializedSizeInBytes

        long serializedSizeInBytes()
        Report the number of bytes required to serialize this bitmap. This is the number of bytes written out when using the serialize method. When using the writeExternal method, the count will be higher due to the overhead of Java serialization.
        Returns:
        the size in bytes
      • toArray

        long[] toArray()
        Return the set values as an array. The integer values are in sorted order.
        Returns:
        array representing the set values.