Package org.roaringbitmap.buffer
Class BufferBitSetUtil
java.lang.Object
org.roaringbitmap.buffer.BufferBitSetUtil
This class provides convenience functions to manipulate BitSet and MutableRoaringBitmap objects.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic MutableRoaringBitmap
bitmapOf(long[] words)
Generate a MutableRoaringBitmap out of a long[], each long using little-endian representation of its bitsstatic MutableRoaringBitmap
bitmapOf(ByteBuffer bb)
Efficiently generate a RoaringBitmap from an uncompressed byte array or ByteBuffer This method tries to minimise all kinds of memory allocationstatic MutableRoaringBitmap
bitmapOf(ByteBuffer bb, long[] wordsBuffer)
Efficiently generate a RoaringBitmap from an uncompressed byte array or ByteBuffer This method tries to minimise all kinds of memory allocation
You can provide a cached wordsBuffer for avoiding 8 KB of extra allocation on every call No reference is kept to the wordsBuffer, so it can be cached as a ThreadLocalstatic MutableRoaringBitmap
Generate a MutableRoaringBitmap out of a BitSetstatic boolean
equals(BitSet bitset, ImmutableRoaringBitmap bitmap)
Compares a RoaringBitmap and a BitSet.
-
Constructor Details
-
BufferBitSetUtil
public BufferBitSetUtil()
-
-
Method Details
-
bitmapOf
Generate a MutableRoaringBitmap out of a BitSet- Parameters:
bitSet
- original bitset (will not be modified)- Returns:
- roaring bitmap equivalent to BitSet
-
bitmapOf
Generate a MutableRoaringBitmap out of a long[], each long using little-endian representation of its bits- Parameters:
words
- array of longs (will not be modified)- Returns:
- roaring bitmap
- See Also:
for an equivalent
-
bitmapOf
Efficiently generate a RoaringBitmap from an uncompressed byte array or ByteBuffer This method tries to minimise all kinds of memory allocation- Parameters:
bb
- the uncompressed bitmap- Returns:
- roaring bitmap
-
bitmapOf
Efficiently generate a RoaringBitmap from an uncompressed byte array or ByteBuffer This method tries to minimise all kinds of memory allocation
You can provide a cached wordsBuffer for avoiding 8 KB of extra allocation on every call No reference is kept to the wordsBuffer, so it can be cached as a ThreadLocal- Parameters:
bb
- the uncompressed bitmapwordsBuffer
- buffer of lengthBitSetUtil.BLOCK_LENGTH
- Returns:
- roaring bitmap
-
equals
Compares a RoaringBitmap and a BitSet. They are equal if and only if they contain the same set of integers.- Parameters:
bitset
- first object to be comparedbitmap
- second object to be compared- Returns:
- whether they are equal
-