SparseArray<T> Class
Structure for sparse array value storage. The main advantage of this class over the standard javascript array is that this class does not need to check each index when iterating values that are stored in the array.
Implements
- Iterable<T | undefined>
Methods
Name | Description | |
---|---|---|
constructor<T>(): SparseArray<T> | ||
[iterator](): IterableIterator<undefined | T> | Iterates the array with all intermediate undefined values |
|
get(index: number): undefined | T | Returns value at specific position. | |
getIndex(lookupValue: T): undefined | number | Returns index of supplied value. | |
getLength(): number | Returns length of array including intermediate 'undefined' values | |
insert(index: number, value: T): void | Inserts value at specific position. | |
iterateValues(): IterableIterator<[T, number]> | Iterates values that are stored in the array | |
remove(index: number): void | Removes value at specified index and reduces array length by one. | |
set(index: number, value: T): void | Sets value at specific position. | |
setLength(length: number): void | Sets length of array. |
Properties
Name | Type | Description | |
---|---|---|---|
[DRAFTABLE] | boolean |
Defined in
Last Updated: 14 November, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.