Import std.collections.set
Set
class
@DebugElements Public Class Set<T: Hashable> Implements Iterable<T>, Cloneable, Defaultable, Hashable
A hash set: values, each held once, in the order they were added.
Examples
Local seen = Set<String>()
Expect(seen.Add("cave"))
Expect(!seen.Add("cave"))
Expect(seen.Contains("cave") && seen.Count == 1)std/collections/set.fb, line 19
-
A new, empty Set.
-
How many values it holds.
-
Adds the
value, and tells whether it's new. -
Removes the
value, and tells whether it was there. The others keep their order. -
Whether it holds
value. -
Takes every value out.
-
Adds each of the
valuesthat isn't there, in their order. -
Removes each of the
valuesthat's there. -
Removes each value that isn't among the
values. -
A new Set of this one's
values, then the other values that aren't among them.Examples
Local a = Set<Int>() a.AddAll([1, 2, 3]) Expect(a.Union([3, 4]).ToArray() == [1, 2, 3, 4]) Expect(a.Intersect([2, 3, 4]).ToArray() == [2, 3]) Expect(a.Difference([2]).ToArray() == [1, 3]) -
A new Set of this one's
valuesthat are among thevaluestoo. -
A new Set of this one's
valuesthat aren't among thevalues. -
A new Set of the
valuesthat are in this one or among thevalues, but not both: this one's first, then the others. -
Whether each of this one's
valuesis among thevalues. -
Whether each of the
valuesis in this one. -
Whether any of the
valuesis in this one. -
Whether the
values, without their repeats, are this one's, in any order. -
The values, in order, in a new array.
-
A new, empty Set.
-
A new Set with the same values, in the same order.
-
A new Set of the values that
keepsays to keep. -
The first value that
testsays is the one, or Null. -
Two Sets are equal when they have the same values, in any order.
-
A Set's hash, the same for equal Sets: its values', added up, so their order doesn't count.
-
The values, in the order they were added. Adding or removing one while going over them panics.
Report an issue with this page or with FutureBlitz on GitHub.