A static extension which provides utility functions for Arrays.

Static methods

staticclear<T>(array:Array<T>):Void

Remove all elements from the array, without creating a new array.

Parameters:

array

The array to clear.

staticclone<T>(array:Array<T>):Array<T>

Create a new array with all elements of the given array, to prevent modifying the original.

staticdeepClone<T, U>(array:Array<U>):Array<T>

Create a new array with clones of all elements of the given array, to prevent modifying the original.

staticisEqualUnordered<T>(a:Array<T>, b:Array<T>):Bool

Return true only if both arrays contain the same elements (possibly in a different order).

Parameters:

a

The first array to compare.

b

The second array to compare.

Returns:

Weather both arrays contain the same elements.

staticisSubset<T>(subset:Array<T>, superset:Array<T>):Bool

Returns true if superset contains all elements of subset.

Parameters:

subset

The array containing the elements to query for.

superset

The array to query for each element.

Returns:

Weather superset contains all elements of subset.

staticisSuperset<T>(superset:Array<T>, subset:Array<T>):Bool

Returns true if superset contains all elements of subset.

Parameters:

superset

The array to query for each element.

subset

The array containing the elements to query for.

Returns:

Weather superset contains all elements of subset.

@:value({ andWord : "and", separator : ", " })staticjoinPlural(array:Array<String>, separator:String = ", ", andWord:String = "and"):String

Like join but adds a word before the last element.

Parameters:

array

The array to join.

separator

The separator to use between elements.

andWord

The word to use before the last element.

Returns:

The joined string.

staticpushUnique<T>(input:Array<T>, element:T):Bool