A set is a list of unique values. Value equality is determined using ==.

See thx.HashSet for an alternative set implementation that uses a hash code to determine item equality.

Static variables

staticread onlylength:Int

Static methods

staticadd(this:Map<T, Bool>, v:T):Bool

add pushes a value into Set if the value was not already present.

It returns a boolean value indicating if Set was changed by the operation or not.

staticcopy(this:Map<T, Bool>):Set<T>

copy creates a new Set with copied elements.

staticcreateEnum<T>(?arr:Iterable<T>):Set<T>

Creates a Set of EnumValue, with optional initial values.

staticcreateInt(?it:Iterable<Int>):Set<Int>

Creates a Set of Ints with optional initial values.

staticcreateObject<T>(?it:Iterable<T>):Set<T>

Creates a Set of anonymous objects with optional initial values.

staticcreateString(?it:Iterable<String>):Set<String>

Creates a Set of Strings with optional initial values.

@:op(A - B)staticinlinedifference(this:Map<T, Bool>, set:Set<T>):Set<T>

difference creates a new Set with elements from the first set excluding the elements from the second.

staticempty(this:Map<T, Bool>):Set<T>

Creates an empty copy of the current set.

staticinlineexists(this:Map<T, Bool>, v:T):Bool

exists returns true if it contains an element that is equals to v.

staticfilter(this:Map<T, Bool>, predicate:T ‑> Bool):Set<T>

staticinlineintersection(this:Map<T, Bool>, set:Set<T>):Set<T>

intersection returns a Set with elements that are presents in both sets

staticiterator(this:Map<T, Bool>):Iterator<T>

Iterates the values of the Set.

staticmap<TOut>(this:Map<T, Bool>, f:T ‑> TOut):Array<TOut>

staticinlinepush(this:Map<T, Bool>, v:T):Void

Like add but doesn't notify if the addition was successful or not.

staticpushMany(this:Map<T, Bool>, values:Iterable<T>):Void

Pushes many values to the set

staticreduce<TOut>(this:Map<T, Bool>, handler:(TOut, T) ‑> TOut, acc:TOut):TOut

staticinlineremove(this:Map<T, Bool>, v:T):Bool

@:tostatictoArray(this:Map<T, Bool>):Array<T>

Converts a Set<T> into Array<T>. The returned array is a copy of the internal array used by Set. This ensures that the set is not affected by unsafe operations that might happen on the returned array.

@:tostatictoString(this:Map<T, Bool>):String

Converts Set into String. To differentiate from normal Arrays the output string uses curly braces {} instead of square brackets [].

@:op(A + B)staticinlineunion(this:Map<T, Bool>, set:Set<T>):Set<T>

Union creates a new Set with elements from both sets.