Import std.collections.bit_set
BitSet
class
@DebugElements Public Class BitSet Implements Iterable<Int>, Cloneable, Defaultable, Hashable
A set of Ints that aren't negative, a bit each, for many small numbers in little space.
Examples
Local set = BitSet()
set.Add(3)
set.Add(64)
Expect(!set.Add(3))
Expect(set.Count == 2)
Expect(set.Contains(64) && !set.Contains(4))
Expect(set.ToArray() == [3, 64])std/collections/bit_set.fb, line 23
-
How many values it holds.
-
Adds the
value, and tells whether it's new. A negativevaluepanics. -
Adds each of the
values, which are all read first. A negative value panics. -
Removes the
value, and tells whether it was there. -
Whether it holds
value. -
Takes every value out.
-
The smallest value, or Null when there's none.
-
The largest value, or Null when there's none.
-
A new BitSet of the values in either.
-
A new BitSet of the values in both.
Examples
Local a = BitSet() a.AddAll([1, 2, 3]) Local b = BitSet() b.AddAll([2, 3, 4]) Expect(a.Intersect(b).ToArray() == [2, 3]) Expect(a.Union(b).Count == 4) -
A new BitSet of this one's values that
otherdoesn't have. -
A new BitSet of the values in one but not the
other. -
Adds each of
other's values. -
Removes each of
other's values. -
Keeps only the values
otherhas too. -
Whether each of its values is in
other. -
Whether it has each of
other's values. -
Whether the two have a value in common.
-
The values, smallest first, in a new array.
-
A new, empty BitSet.
-
A new BitSet with the same values.
-
Two BitSets are equal when they have the same values.
-
A hash of its values, which BitSets that are equal share.
-
The values, smallest first. Adding or removing one while going over them panics.
Report an issue with this page or with FutureBlitz on GitHub.