IndexMap<T> Class

Maintains a set of unique elements in sorted order and retains the insertion order of each. The uniqueness of the elements is determined by a comparison routine supplied by the user. The user may also supply a maximum size, beyond which insertions will fail.

Methods

Name Description
constructor(compare: OrderedComparator<T>, maximumSize: number = Number.MAX_SAFE_INTEGER, clone: CloneFunction<T> = shallowClone): IndexMap Construct a new IndexMap.  
clear(): void Removes all elements from the map.  
indexOf(value: T): number Finds the index of an element equivalent to the supplied value.  
insert(value: T, onInsert?: (value: T) => any): number Attempt to insert a new value into the map.  
lowerBound(value: T): { equal: boolean, index: number } Protected    

Properties

Name Type Description
_array Protected Array<IndexedValue<T>>    
_clone Protected CloneFunction<T>    
_compareValues Protected OrderedComparator<T>    
_maximumSize Protected number    
isEmpty Accessor ReadOnly boolean Returns true if the map contains no elements.  
isFull Accessor ReadOnly boolean Returns true if the maximum number of elements have been inserted.  
length Accessor ReadOnly number The number of elements in the map.  

Defined in

Last Updated: 13 June, 2024