Unlike java.util.bitset, the fact that bits are packed into an array of longs is part of the interface. This allows efficient implementation of other algorithms by someone other than the author. It also allows one to efficiently implement alternate serialization or interchange formats.
The index range for a bitset can easily exceed positive int
range in Java (0x7fffffff), so many methods in this class accept or return a long
. There are adapter methods that return views compatible with {@link LongLookupContainer} and {@link IntLookupContainer} interfaces.
boolean
value. The bits of a BitSet
are indexed by nonnegative integers. Individual indexed bits can be examined, set, or cleared. One BitSet
may be used to modify the contents of another BitSet
through logical AND, logical inclusive OR, and logical exclusive OR operations. By default, all bits in the set initially have the value false
.
Every bit set has a current size, which is the number of bits of space currently in use by the bit set. Note that the size is related to the implementation of a bit set, so it may change with implementation. The length of a bit set relates to logical length of a bit set and is defined independently of implementation.
Unless otherwise noted, passing a null parameter to any of the methods in a BitSet
will result in a NullPointerException
.
A BitSet
is not safe for multithreaded use without external synchronization.
@author Arthur van Hoff
@author Michael McCloskey
@author Martin Buchholz
@version 1.67, 04/07/06
@since JDK1.0
|
|
|
|
|
|
|
|
|
|
|
|