class BitSet extends Serializable
BitSet
copy from spark
A simple, fixed-size bit set implementation. This implementation is fast because it avoids safety/bound checking.
- Version
1.0
- Since
2021/3/30 3:35 下午
- Alphabetic
- By Inheritance
- BitSet
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new BitSet(numBits: Int)
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- def &(other: BitSet): BitSet
Compute the bit-wise AND of the two sets returning the result.
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def ^(other: BitSet): BitSet
Compute the symmetric difference by performing bit-wise XOR of the two sets returning the result.
- def andNot(other: BitSet): BitSet
Compute the difference of the two sets by performing bit-wise AND-NOT returning the result.
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def capacity: Int
Compute the capacity (number of bits) that can be represented by this bitset.
- def cardinality(): Int
Return the number of bits set to true in this BitSet.
- def clear(): Unit
Clear all set bits.
- def clearUntil(bitIndex: Int): Unit
Clear all the bits up to a given index
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def get(index: Int): Boolean
Return the value of the bit with the specified index.
Return the value of the bit with the specified index. The value is true if the bit with the index is currently set in this BitSet; otherwise, the result is false.
- index
the bit index
- returns
the value of the bit with the specified index
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def iterator: Iterator[Int]
Get an iterator over the set bits.
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def nextSetBit(fromIndex: Int): Int
Returns the index of the first bit that is set to true that occurs on or after the specified starting index.
Returns the index of the first bit that is set to true that occurs on or after the specified starting index. If no such bit exists then -1 is returned.
To iterate over the true bits in a BitSet, use the following loop:
for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) { // operate on index i here }
- fromIndex
the index to start checking from (inclusive)
- returns
the index of the next set bit, or -1 if there is no such bit
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def set(index: Int): Unit
Sets the bit at the specified index to true.
Sets the bit at the specified index to true.
- index
the bit index
- def setUntil(bitIndex: Int): Unit
Set all the bits up to a given index
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def unset(index: Int): Unit
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- def |(other: BitSet): BitSet
Compute the bit-wise OR of the two sets returning the result.