Class: DictionaryMapBased

DictionaryMapBased(eqCompareropt)

new DictionaryMapBased(eqCompareropt)

Parameters:
Name Type Attributes Description
eqComparer EqualityComparer.<TVal> <optional>
Author:
Source:

Extends

Members

observableDelete

Source:

observableGet

Source:

observableSet

Source:

size :Number

Type:
  • Number
Source:

Methods

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) → {TVal}

Parameters:
Name Type Description
key TKey The key of the value to retrieve.
Source:
Throws:
If the key is not found.
Type
Error
Returns:
Type
TVal

has(key) → {Boolean}

Parameters:
Name Type Description
key TKey The key to check for
Source:
Returns:
Type
Boolean

hasValue(value, eqCompareropt) → {Boolean}

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:
Returns:
Type
Boolean

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>