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
__@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
__computed Static boolean    

Defined in

Last Updated: 08 January, 2020