Class ConcurrentBitSet
- java.lang.Object
-
- java.util.BitSet
-
- org.apache.pulsar.common.util.collections.ConcurrentBitSet
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
- Direct Known Subclasses:
ConcurrentBitSetRecyclable
public class ConcurrentBitSet extends java.util.BitSet
Safe multithreaded version ofBitSet
.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ConcurrentBitSet()
ConcurrentBitSet(int nbits)
Creates a bit set whose initial size is large enough to explicitly represent bits with indices in the range0
throughnbits-1
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
get(int bitIndex)
boolean
isEmpty()
int
nextClearBit(int fromIndex)
int
nextSetBit(int fromIndex)
int
previousClearBit(int fromIndex)
int
previousSetBit(int fromIndex)
void
set(int bitIndex)
void
set(int fromIndex, int toIndex)
-
-
-
Constructor Detail
-
ConcurrentBitSet
public ConcurrentBitSet()
-
ConcurrentBitSet
public ConcurrentBitSet(int nbits)
Creates a bit set whose initial size is large enough to explicitly represent bits with indices in the range0
throughnbits-1
. All bits are initiallyfalse
.- Parameters:
nbits
- the initial size of the bit set- Throws:
java.lang.NegativeArraySizeException
- if the specified initial size is negative
-
-
Method Detail
-
get
public boolean get(int bitIndex)
- Overrides:
get
in classjava.util.BitSet
-
set
public void set(int bitIndex)
- Overrides:
set
in classjava.util.BitSet
-
set
public void set(int fromIndex, int toIndex)
- Overrides:
set
in classjava.util.BitSet
-
nextSetBit
public int nextSetBit(int fromIndex)
- Overrides:
nextSetBit
in classjava.util.BitSet
-
nextClearBit
public int nextClearBit(int fromIndex)
- Overrides:
nextClearBit
in classjava.util.BitSet
-
previousSetBit
public int previousSetBit(int fromIndex)
- Overrides:
previousSetBit
in classjava.util.BitSet
-
previousClearBit
public int previousClearBit(int fromIndex)
- Overrides:
previousClearBit
in classjava.util.BitSet
-
isEmpty
public boolean isEmpty()
- Overrides:
isEmpty
in classjava.util.BitSet
-
-