类 ConcurrentBitSet
java.lang.Object
java.util.BitSet
org.apache.pulsar.common.util.collections.ConcurrentBitSet
- 所有已实现的接口:
Serializable,Cloneable
- 直接已知子类:
ConcurrentBitSetRecyclable
A
BitSet that is protected by a StampedLock to provide thread-safe access.
The BitSet.length() method is not thread safe and is not overridden because StampedLock is not reentrant.
Use the safeLength() method to get the length of the bit set in a thread-safe manner.- 另请参阅:
-
构造器概要
构造器构造器说明ConcurrentBitSet(int nbits) Creates a bit set whose initial size is large enough to explicitly represent bits with indices in the range0throughnbits-1. -
方法概要
修饰符和类型方法说明voidvoidintvoidclear()voidclear(int bitIndex) voidclear(int fromIndex, int toIndex) clone()Returns the clone of the internal wrappedBitSet.booleanvoidflip(int bitIndex) voidflip(int fromIndex, int toIndex) booleanget(int bitIndex) get(int fromIndex, int toIndex) inthashCode()booleanintersects(BitSet set) booleanisEmpty()intnextClearBit(int fromIndex) intnextSetBit(int fromIndex) voidintpreviousClearBit(int fromIndex) intpreviousSetBit(int fromIndex) intThread-safe version oflength().voidset(int bitIndex) voidset(int bitIndex, boolean value) voidset(int fromIndex, int toIndex) voidset(int fromIndex, int toIndex, boolean value) intsize()stream()This operation is not supported onConcurrentBitSet.byte[]long[]toString()void
-
构造器详细资料
-
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 range0throughnbits-1. All bits are initiallyfalse.- 参数:
nbits- the initial size of the bit set- 抛出:
NegativeArraySizeException- if the specified initial size is negative
-
-
方法详细资料
-
get
public boolean get(int bitIndex) -
set
public void set(int bitIndex) -
clear
public void clear(int bitIndex) -
set
public void set(int fromIndex, int toIndex) -
clear
public void clear(int fromIndex, int toIndex) -
clear
public void clear() -
nextSetBit
public int nextSetBit(int fromIndex) - 覆盖:
nextSetBit在类中BitSet
-
nextClearBit
public int nextClearBit(int fromIndex) - 覆盖:
nextClearBit在类中BitSet
-
previousSetBit
public int previousSetBit(int fromIndex) - 覆盖:
previousSetBit在类中BitSet
-
previousClearBit
public int previousClearBit(int fromIndex) - 覆盖:
previousClearBit在类中BitSet
-
isEmpty
public boolean isEmpty() -
cardinality
public int cardinality()- 覆盖:
cardinality在类中BitSet
-
size
public int size() -
toByteArray
public byte[] toByteArray()- 覆盖:
toByteArray在类中BitSet
-
toLongArray
public long[] toLongArray()- 覆盖:
toLongArray在类中BitSet
-
flip
public void flip(int bitIndex) -
flip
public void flip(int fromIndex, int toIndex) -
set
public void set(int bitIndex, boolean value) -
set
public void set(int fromIndex, int toIndex, boolean value) -
get
-
safeLength
public int safeLength()Thread-safe version oflength(). StampedLock is not reentrant and that's why the length() method is not overridden. Overriding length() method would require to use a reentrant lock which would be less performant.- 返回:
- length of the bit set
-
intersects
- 覆盖:
intersects在类中BitSet
-
and
-
or
-
xor
-
andNot
-
clone
Returns the clone of the internal wrappedBitSet. This won't be a clone of theConcurrentBitSetobject. -
toString
-
stream
This operation is not supported onConcurrentBitSet. -
equals
-
hashCode
public int hashCode()
-