API Reference > bentleyjs-core > Collections > IndexMap 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<T>(compare: OrderedComparator<T, T>, maximumSize: number = Number.MAX_SAFE_INTEGER, clone: CloneFunction<T> = shallowClone): IndexMap<T> 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 toArray(): T[] Return an array of the elements in this map in which the array index of each element corresponds to the index assigned to it by the map. Properties Name Type Description _array Protected IndexedValue<T>[] _clone ProtectedReadonly CloneFunction<T> _compareValues ProtectedReadonly OrderedComparator<T, T> _maximumSize ProtectedReadonly 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 core/bentley/src/IndexMap.ts Line 31 Last Updated: 11 June, 2024