new Dictionary(eqCompareropt)
Creates a new, empty Dictionary..
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eqComparer |
EqualityComparer.<TEq> |
<optional> |
Optional. Defaults To EqualityComparer. |
- Deprecated:
- Use DictionaryMapBased instead. This Dictionary will be removed from version v3.0. Also, DictionaryMapBased will receive an alias of Dictionary.
- Source:
Members
size
- Source:
Methods
clear() → {this}
Removes all items from this dictionary.
- Source:
Returns:
- Type
- this
delete(key) → {T}
Parameters:
Name | Type | Description |
---|---|---|
key |
String | Symbol |
- Source:
Returns:
The value of the removed item
- Type
- T
(generator) entries() → {IterableIterator.<Object.<(String|Symbol), T>>}
Returns all entries of this dictionary. Note that the order is deterministic and
that therefore returning the entries in reverse order may also be of use.
- Source:
Returns:
- Type
- IterableIterator.<Object.<(String|Symbol), T>>
(generator) entriesReversed() → {IterableIterator.<Object.<(String|Symbol), T>>}
- Source:
Returns:
- Type
- IterableIterator.<Object.<(String|Symbol), T>>
get(key) → {T}
Parameters:
Name | Type | Description |
---|---|---|
key |
String | Symbol | The item's key. |
- Source:
Throws:
-
If the key is not present.
- Type
- Error
Returns:
The item
- Type
- T
has(item, eqComparer)
Parameters:
Name | Type | Default | Description |
---|---|---|---|
item |
T | The item to check for | |
eqComparer |
EqualityComparer.<TEq> | null | An optional EqualityComparer to use. If not provided, will use the Collection's EqualityComparer. |
- Source:
hasKey(key) → {Boolean}
Does not support an @see {EqualityComparer.} and can therefore facilitate faster O(1) lookups.
Parameters:
Name | Type | Description |
---|---|---|
key |
String | Symbol | The item's key. |
- Source:
Returns:
True, if the given key is present.
- Type
- Boolean
hasKeyEq(key, eqCompareropt) → {Boolean}
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
key |
String | Symbol | The item's key. | ||
eqComparer |
EqualityComparer.<TEq> |
<optional> |
null | an optional EqualityComparer to use. If not provided, will use the Collection's EqualityComparer. |
- Source:
Returns:
True, if the given key is present.
- Type
- Boolean
(generator) keys() → {IterableIterator.<(String|Symbol)>}
- Source:
Returns:
- Type
- IterableIterator.<(String|Symbol)>
remove(key) → {T}
Parameters:
Name | Type | Description |
---|---|---|
key |
String | Symbol | The item's key. |
- Deprecated:
- Use ::delete(key) instead. This will be removed in v3.0.
- Source:
Throws:
-
If the given key is not present.
- Type
- Error
Returns:
The removed item.
- Type
- T
set(key, val)
Sets the item with the given key. If the key exists previously, its
value is overwritten.
Parameters:
Name | Type | Description |
---|---|---|
key |
String | Symbol | |
val |
T |
- Source:
(generator) values() → {IterableIterator.<T>}
- Source:
Returns:
- Type
- IterableIterator.<T>