SparseArray<T> Class

Beta  

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
[Symbol.iterator](): IterableIterator<T | undefined> Iterates the array with all intermediate undefined values  
get(index: number): T | undefined Returns value at specific position.  
getIndex(lookupValue: T): number | undefined 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 specific position.  
set(index: number, value: T): void Sets value at specific position.  
setLength(length: number): void Sets length of array.  

Properties

Name Type Description
[immerable] Static boolean    

Defined in

Last Updated: 13 June, 2024