CLASSES
TagsA - Z

SmartArray

Description

class SmartArray

Create a new smart array

Constructor

new SmartArray(capacity)

Parameters

Name Type Description
capacity number @param capacity

Members

data : Array<T>

Array

length : number

The length of the smart array

Methods

push(value) → void

Push method. If the length of the smart array is reached, the length of this array is doubled.

Parameters

Name Type Description
value any @param value

forEach(func) → void

Parameters

Name Type Description
func (content: T) => void

pushNoDuplicate(value) → boolean

Push method to avoid any duplicate. If the value is found in the smart array, nothing is done.

Parameters

Name Type Description
value any @param value

sort(compareFn) → void

Sort this array with the sort function given in parameter.

Parameters

Name Type Description
compareFn any @param compareFn

reset() → void

Reset the length of this smart array

dispose() → void

concat(array) → void

Append the given smart array data to this smart array.

Parameters

Name Type Description
array any @param array

concatWithNoDuplicate(array) → void

Append the given smart array data to this smart array. This function check if each values are not already in the smart array.

Parameters

Name Type Description
array any @param array

indexOf(value) → number

Parameters

Name Type Description
value T @param value

contains(value) → boolean

Parameters

Name Type Description
value T @param value