- 所有已知子接口:
LongBitmapDataProvider
- 所有已知实现类:
Roaring64Bitmap,Roaring64NavigableMap
public interface ImmutableLongBitmapDataProvider
Interface representing an immutable bitmap.
-
嵌套类概要
嵌套类修饰符和类型接口说明static final classAn internal class to help provide streams. -
方法概要
修饰符和类型方法说明booleancontains(long x) Checks whether the value in included, which is equivalent to checking if the corresponding bit is set (get in BitSet class).longfirst()Get the first (smallest) integer in this RoaringBitmap, that is, return the minimum of the set.voidforEach(LongConsumer lc) Visit all values in the bitmap and pass them to the consumerlongReturns the number of distinct integers added to the bitmap (e.g., number of bits set).For better performance, consider the Use theforEachmethod.longEstimate of the memory usage of this data structure.intEstimate of the memory usage of this data structure.booleanisEmpty()Checks whether the bitmap is empty.longlast()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.longrankLong(long x) Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).default LongStreamlongselect(long j) Return the jth value stored in this bitmap.voidserialize(DataOutput out) Serialize this bitmap.longReport the number of bytes required to serialize this bitmap.default LongStreamstream()long[]toArray()Return the set values as an array.
-
方法详细资料
-
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).- 参数:
x- long value- 返回:
- 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.- 返回:
- the cardinality
-
forEach
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 }});}- 参数:
lc- the consumer
-
getLongIterator
LongIterator getLongIterator()For better performance, consider the Use theforEachmethod.- 返回:
- a custom iterator over set bits, the bits are traversed in ascending sorted order
-
getReverseLongIterator
LongIterator getReverseLongIterator()- 返回:
- a custom iterator over set bits, the bits are traversed in descending sorted order
-
stream
- 返回:
- an Ordered, Distinct, Sorted and Sized IntStream in ascending order
-
reverseStream
- 返回:
- 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.- 返回:
- estimated memory usage.
-
getLongSizeInBytes
long getLongSizeInBytes()Estimate of the memory usage of this data structure. Provides full 64-bit number.- 返回:
- estimated memory usage.
-
isEmpty
boolean isEmpty()Checks whether the bitmap is empty.- 返回:
- true if this bitmap contains no set bit
-
limit
Create a new bitmap of the same class, containing at most maxcardinality integers.- 参数:
x- maximal cardinality- 返回:
- 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.- 参数:
x- upper limit- 返回:
- the rank
-
select
long select(long j) Return the jth value stored in this bitmap.- 参数:
j- index of the value- 返回:
- the value
-
first
long first()Get the first (smallest) integer in this RoaringBitmap, that is, return the minimum of the set.- 返回:
- the first (smallest) integer
- 抛出:
NoSuchElementException- if empty
-
last
long last()Get the last (largest) integer in this RoaringBitmap, that is, return the maximum of the set.- 返回:
- the last (largest) integer
- 抛出:
NoSuchElementException- if empty
-
serialize
Serialize this bitmap. The current bitmap is not modified.- 参数:
out- the DataOutput stream- 抛出:
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.- 返回:
- the size in bytes
-
toArray
long[] toArray()Return the set values as an array. The integer values are in sorted order.- 返回:
- array representing the set values.
-