Skip to main content

EquatableKeyDictionary

Classes

EquatableKeyDictionary

Represents a dictionary which key supports comparison through equals() method

Type Parameters

Type Parameter
TKey extends IEquatable<TKey>
TValue

Constructors

Constructor
new EquatableKeyDictionary<TKey, TValue>(entries?): EquatableKeyDictionary<TKey, TValue>;
Parameters
ParameterType
entries?Iterable<[TKey, TValue]>
Returns

EquatableKeyDictionary<TKey, TValue>

Accessors

size
Get Signature
get size(): number;
Returns

number

Methods

[iterator]()
iterator: IterableIterator<[TKey, TValue]>;
Returns

IterableIterator<[TKey, TValue]>

clear()
clear(): void;
Returns

void

delete()
delete(key): boolean;
Parameters
ParameterType
keyTKey
Returns

boolean

entries()
entries(): IterableIterator<[TKey, TValue]>;
Returns

IterableIterator<[TKey, TValue]>

forEach()
forEach(callbackfn, thisArg?): void;
Parameters
ParameterType
callbackfn(value, key, map) => void
thisArg?any
Returns

void

get()
get(key): TValue;
Parameters
ParameterType
keyTKey
Returns

TValue

has()
has(key): boolean;
Parameters
ParameterType
keyTKey
Returns

boolean

hasEqual()
hasEqual(keyValue): boolean;

Indicates whether an element with the key equal to given keyValue exists or not.

Parameters
ParameterType
keyValueTKey
Returns

boolean

keys()
keys(): IterableIterator<TKey>;
Returns

IterableIterator<TKey>

set()
set(key, value): this;
Parameters
ParameterType
keyTKey
valueTValue
Returns

this

tryGetKeyEqualTo()
tryGetKeyEqualTo(keyValue): object;

Tries to find a key in the dictionary that is equal to given keyValue.

Returns:

hasKey - indicates whether such a key was found in the dictionary;

key - contains key that is equal to keyValue or null if such key was not found.

Parameters
ParameterType
keyValueTKey
Returns

object

hasKey
hasKey: boolean;
key?
optional key?: TKey;
tryGetValueOf()
tryGetValueOf(keyValue): object;

Tries to find a value in the dictionary corresponding to the key equal to given keyValue.

Returns:

hasValue - indicates whether the value with such key was found;

value - contains value with the key equal to keyValue or null if such key was not found.

Parameters
ParameterType
keyValueTKey
Returns

object

hasValue
hasValue: boolean;
value
value: TValue;
values()
values(): IterableIterator<TValue>;
Returns

IterableIterator<TValue>

Interfaces

IEquatable

Type Parameters

Type Parameter
T

Methods

equals()
equals(other): boolean;
Parameters
ParameterType
otherT
Returns

boolean

Was this page helpful?