BitSet class

A space-efficient set implementation for managing boolean flags. Mimics C++ std::bitset functionality.

Constructors

BitSet(int _length)
Creates a BitSet with a fixed number of bits.

Properties

hashCode int
The hash code for this object.
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

all() bool
Checks if all bits are set to true.
any() bool
Checks if any bit is set to true.
count() int
Counts the total number of bits set to true.
flip([int? index]) → void
Flips the bit at index. If no index is provided, flips all bits.
none() bool
Checks if no bits are set (all false).
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset(int index) → void
Sets the bit at index to false.
set(int index, [bool value = true]) → void
Sets the bit at index to true (or the provided value).
size() int
The number of bits this BitSet holds.
test(int index) bool
Returns true if the bit at index is set.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
override
operator [](int index) bool
Convenience operator for checking a bit.
operator []=(int index, bool value) → void
Convenience operator for setting a bit.