Interface ImmutableLongBitmapDataProvider

All Known Subinterfaces:
LongBitmapDataProvider
All Known Implementing Classes:
Roaring64Bitmap, Roaring64NavigableMap

public interface ImmutableLongBitmapDataProvider
Interface representing an immutable bitmap.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    An internal class to help provide streams.
  • Method Summary

    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
    Get the first (smallest) integer in this RoaringBitmap, that is, return the minimum of the set.
    void
    Visit all values in the bitmap and pass them to the consumer.
    long
    Returns the number of distinct integers added to the bitmap (e.g., number of bits set).
    For better performance, consider the Use the forEach method.
    long
    Estimate of the memory usage of this data structure.
     
    int
    Estimate of the memory usage of this data structure.
    boolean
    Checks whether the bitmap is empty.
    long
    Get the last (largest) integer in this RoaringBitmap, that is, return the maximum of the set.
    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 LongStream
     
    long
    select(long j)
    Return the jth value stored in this bitmap.
    void
    Serialize this bitmap.
    long
    Report the number of bytes required to serialize this bitmap.
    default LongStream
     
    long[]
    Return the set values as an array.
  • Method Details

    • 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 LongStream stream()
      Returns:
      an Ordered, Distinct, Sorted and Sized IntStream in ascending order
    • reverseStream

      default 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

      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:
      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:
      NoSuchElementException - if empty
    • serialize

      void serialize(DataOutput out) throws IOException
      Serialize this bitmap. The current bitmap is not modified.
      Parameters:
      out - the DataOutput stream
      Throws:
      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.