Class SmartArray<T>
Type Parameters
- T
Hierarchy (View Summary)
- SmartArray
Implements
Constructors
constructor
-
Instantiates a Smart Array.
Type Parameters
- T
Parameters
- capacity: number
defines the default capacity of the array.
Returns SmartArray<T>
Properties
data
The full set of data from the array.
length
The active length of the array.
Methods
concat
-
Concats the active data with a given array.
Parameters
- array: any
defines the data to concatenate with.
Returns void
- array: any
contains
-
Returns whether an element is part of the active data.
Parameters
- value: T
defines the value to look for
Returns boolean
true if found in the active data otherwise false
- value: T
dispose
-
Releases all the data from the array as well as the array.
Returns void
for Each
-
Iterates over the active data and apply the lambda to them.
Parameters
- func: (content: T) => void
defines the action to apply on each value.
Returns void
- func: (content: T) => void
index Of
-
Returns the position of a value in the active data.
Parameters
- value: T
defines the value to find the index for
Returns number
the index if found in the active data otherwise -1
- value: T
push
-
Pushes a value at the end of the active data.
Parameters
- value: T
defines the object to push in the array.
Returns void
- value: T
reset
-
Resets the active data to an empty array.
Returns void
Defines an GC Friendly array where the backfield array do not shrink to prevent over allocations.