Construct a new string-based dictionary.
const d = new StringDict<number>()
You can also constrcut this dictionary from any iterable, like so:
const d = new StringDict([
['one', 1],
['two', 2]
])
Optional
iterable: Iterable<[string, V], any, any>Count the amount of elements in the collection.
⚠️ In most cases, this should be an O(1)
operation. However, there are
cases where this can be an O(n)
operation. Therefore, it is recommended
to always cache the result in a local variable.
Returns an object which is able to sift through the values in this collection.
The order by which the elements are traversed depends on the kind of collection. For unordered collections, the iteration order is unspecified and may even differ between two iterations on the same collection.
Add an element to the collection. If the element already exists, update its value.
The location where the element is placed depends on the collection type, and in the generic case there is no guarantee on the location where it is inserted.
This method returns a pair with the first element indicating whether the element was added, while the second element refers to the actual location of the element.
A transparent object obtained by getAddHint.
Copies all elements in the collection to a new one of the same kind.
A hash-based dictionary for strings, which wraps a native JavaScript object to provide very fast lookup, insertion and deletion.
When two items are added with the same key, the second item will override the first.
All operations in the dictionary are in
O(1)
.Deprecated