Constructs a new IndexedMap.
The initial capacity of the map. Defaults to 0.
Gets the current capacity of the map. This is not the number of items stored in the map, but rather the size of the internal array.
The current capacity of the map.
Clears all items from the map. This is a heavy operation as it has to zero out the memory used by.
Gets the value for the given key.
The key to get the value for.
The value for the key, or undefined if the key does not exist.
Checks if the map contains the given key.
The key to check for.
true if the key exists in the map, otherwise false.
A simple map-like data structure that uses an array for storage. This class is not memory efficient for sparse lookups, as it uses an array internally and will allocate memory for all indices up to the highest key used. It is however very fast for lookups.
Remarks
It is not possible to store
undefinedvalues in this map, asundefinedis used to represent keys that have not been set. This class is only intended to be used where the key is mostly a sequential number.