new DictionaryMapBased(eqCompareropt)
Parameters:
- Author:
-
- Source:
Members
_map :Map.<TKey, TVal>
Type:
- Source:
observableDelete
- Source:
observableGet
- Source:
observableSet
- Source:
Methods
(protected) __unwrapKey(key) → {TKey}
Used for unwrapping values. This is useful for collections that wrap
the key in some way. The DictionaryMap's methods use this method, so
that deriving subclasses only need to override this method.
Parameters:
Name |
Type |
Description |
key |
TKey
|
The key to unwrap |
- Source:
- See:
-
Returns:
In this base class, this is an identity function.
Sub-classes may override it.
-
Type
-
TKey
(protected) __unwrapValue(value) → {TVal}
Used for unwrapping values. This is useful for collections that wrap
the value in some way. The DictionaryMap's methods use this method,
so that deriving subclasses only need to override this method.
Parameters:
Name |
Type |
Description |
value |
TVal
|
The value to unwrap |
- Source:
- See:
-
Returns:
In this base class, this is an identity function.
Sub-classes may override it.
-
Type
-
TVal
clear() → {this}
- Source:
Returns:
-
Type
-
this
delete(key) → {TVal}
Parameters:
Name |
Type |
Description |
key |
TKey
|
The of the entry to delete. |
- Source:
Throws:
-
If the key cannot be found or cannot be deleted.
-
-
Type
-
Error
Returns:
The deleted value
-
Type
-
TVal
(generator) entries()
- Source:
Returns:
(generator) entriesReversed()
- Source:
Returns:
forEach(callbackFn, thisArgopt)
Parameters:
Name |
Type |
Attributes |
Description |
callbackFn |
consumerProducer4ArgHandler.<TVal, TKey, Number, Dictionary.<TKey, TVal>, any>
|
|
receives the value, the key, the index, and the dictionary |
thisArg |
*
|
<optional>
|
Optional. Defaults to undefined. |
- Source:
get(key)
Parameters:
Name |
Type |
Description |
key |
TKey
|
The key of the value to retrieve. |
- Source:
Throws:
-
If the key is not found.
-
-
Type
-
Error
has(key)
Parameters:
Name |
Type |
Description |
key |
TKey
|
The key to check for |
- Source:
hasValue(value, eqCompareropt)
Parameters:
Name |
Type |
Attributes |
Default |
Description |
value |
TVal
|
|
|
The value to check for |
eqComparer |
EqualityComparer.<TVal>
|
<optional>
|
null
|
An optional @see {EqualityComparer}. Uses the internal comparer if not given. |
- Source:
invert(eqCompareropt) → {DictionaryMapBased.<TVal, Array.<TKey>>}
Inverts this dictionary by using its values as keys, and storing
for each value a list of keys that previously pointed to that
value. Therefore, the values in the inverted dictionary are lists.
E.g., the dictionary {A=>5, B=>5, C=>2} inverts to the dictionary
{5=>[A,B], 2=>[C]}. Therefore, you also cannot invert an inverted
dictionary and obtain a dictionary equivalent to the original.
Parameters:
Name |
Type |
Attributes |
Description |
eqComparer |
EqualityComparer.<TVal>
|
<optional>
|
Optional. Uses the
default EqualityComparer if not given. You may also pass in this
dictionary's comparer. It may make sense to use a separate comparer,
as the values may be of different type than the keys. |
- Source:
Returns:
-
Type
-
DictionaryMapBased.<TVal, Array.<TKey>>
(generator) keys() → {IterableIterator.<TKey>}
- Source:
Returns:
-
Type
-
IterableIterator.<TKey>
set(key, value) → {this}
Sets (upserts) a value with the given key.
Parameters:
Name |
Type |
Description |
key |
TKey
|
The key of the value. |
value |
TVal
|
The value associated with the key. |
- Source:
Returns:
-
Type
-
this
(generator) values() → {IterableIterator.<TVal>}
- Source:
Returns:
-
Type
-
IterableIterator.<TVal>