A collection that contains no duplicate elements. The underlying data structure is a Haxe Array. Elements are compared using the standard equality operator.

Static methods

staticadd (this:Array<T>, element:T):Bool

Attempts to add an element to the set. The added element must not be null. Succeeds if the element is not already in the set, fails if it was in the set.

Parameters:

element

The element to add to the set.

Returns:

True if the element was not present, false if it was already present.

staticcontains (this:Array<T>, element:T):Bool

Checks if an element is contained within the set.

Parameters:

element

The element to search the set for. The element must not be null.

Returns:

True if the element is present, false it is not present.

staticinline copy (this:Array<T>):ArraySet<T>

Copies the set. Analogous to Array.copy().

Returns:

A shallow copy of the original set.

staticcreate<T> (?array:Array<T>):ArraySet<T>

Creates a set from an Array.

Parameters:

array

The Array to convert to a set.

Returns:

The new ArraySet.

staticinline difference (this:Array<T>, set:ArraySet<T>):ArraySet<T>

Returns a new set containing the difference of two sets. i.e. difference([A, B, C], [B, C, D]) => [A, D].

Parameters:

set

The set to difference with this set.

Returns:

The difference of this set and the given set.

staticinline intersection (this:Array<T>, set:ArraySet<T>):ArraySet<T>

Returns a new set containing the intersection of two sets. i.e. intersect([A, B, C], [B, C, D]) => [B, C].

Parameters:

set

The set to intersect with this set.

Returns:

The intersection of this set and the given set.

staticinline slice (this:Array<T>, position:Int, ?end:Int):ArraySet<T>

Wraps the Array.slice method, returns an ArraySet instead of an Array.

Parameters:

position

The inclusive start index of the slice operation.

end

The exclusive end index of the slice operation.

Returns:

The requested slice of the ArraySet.

staticinline splice (this:Array<T>, position:Int, length:Int):ArraySet<T>

Wraps the Array.splice method, returns an ArraySet instead of an Array.

Parameters:

position

The inclusive start index of the slice operation.

length

The number of elements to remove.

Returns:

The requested section of the ArraySet.

statictoArray (this:Array<T>):Array<T>

Converts the set into an Array.

Returns:

A shallow copy of the set as an Array.

statictoSet<T> (array:Array<T>):ArraySet<T>

Converts an Array to a set, removing all duplicated values.

Parameters:

array

The Array to convert to a set.

Returns:

The newly created ArraySet.

staticinline union (this:Array<T>, set:ArraySet<T>):ArraySet<T>

Returns a new set containing the union of two sets. i.e. union([A, B, C], [B, C, D]) => [A, B, C, D].

Parameters:

set

The set to unify with this set.

Returns:

The union of this set and the given set.

staticinline unionArray (this:Array<T>, array:Array<T>):ArraySet<T>

Returns a new set containing the union of the set and array. i.e. union([A, B, C], [B, C, D]) => [A, B, C, D].

Parameters:

array

The array to unify with this set.

Returns:

The union of this set and the given Array.