---
title: "EquatableKeyDictionary | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/design-atoms-js/reference/design-atoms-model/EquatableKeyDictionary/"
---

# EquatableKeyDictionary

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

## Classes

### EquatableKeyDictionary

#### Type Parameters

| Type Parameter |
| ------ |
| `TKey` *extends* [`IEquatable`](#iequatable)\<`TKey`\> |
| `TValue` |

#### Constructors

##### Constructor

```ts
new EquatableKeyDictionary<TKey, TValue>(entries?): EquatableKeyDictionary<TKey, TValue>;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `entries?` | `Iterable`\<\[`TKey`, `TValue`\]\> |

###### Returns

[`EquatableKeyDictionary`](#equatablekeydictionary)\<`TKey`, `TValue`\>

#### Accessors

##### size

###### Get Signature

```ts
get size(): number;
```

###### Returns

`number`

#### Methods

##### \[iterator\]()

```ts
iterator: IterableIterator<[TKey, TValue]>;
```

###### Returns

`IterableIterator`\<\[`TKey`, `TValue`\]\>

##### clear()

```ts
clear(): void;
```

###### Returns

`void`

##### delete()

```ts
delete(key): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `key` | `TKey` |

###### Returns

`boolean`

##### entries()

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

###### Returns

`IterableIterator`\<\[`TKey`, `TValue`\]\>

##### forEach()

```ts
forEach(callbackfn, thisArg?): void;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `callbackfn` | (`value`, `key`, `map`) => `void` |
| `thisArg?` | `any` |

###### Returns

`void`

##### get()

```ts
get(key): TValue;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `key` | `TKey` |

###### Returns

`TValue`

##### has()

```ts
has(key): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `key` | `TKey` |

###### Returns

`boolean`

##### hasEqual()

```ts
hasEqual(keyValue): boolean;
```

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

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `keyValue` | `TKey` |

###### Returns

`boolean`

##### keys()

```ts
keys(): IterableIterator<TKey>;
```

###### Returns

`IterableIterator`\<`TKey`\>

##### set()

```ts
set(key, value): this;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `key` | `TKey` |
| `value` | `TValue` |

###### Returns

`this`

##### tryGetKeyEqualTo()

```ts
tryGetKeyEqualTo(keyValue): object;
```

Tries to find a key in the dictionary that is equal to given [keyValue](#trygetkeyequalto).

Returns:

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

key - contains key that is equal to [keyValue](#trygetkeyequalto) or null if such key was not found.

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `keyValue` | `TKey` |

###### Returns

`object`

###### hasKey

```ts
hasKey: boolean;
```

###### key?

```ts
optional key?: TKey;
```

##### tryGetValueOf()

```ts
tryGetValueOf(keyValue): object;
```

Tries to find a value in the dictionary corresponding to the key equal to given [keyValue](#trygetvalueof).

Returns:

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

value - contains value with the key equal to [keyValue](#trygetvalueof) or null if such key was not found.

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `keyValue` | `TKey` |

###### Returns

`object`

###### hasValue

```ts
hasValue: boolean;
```

###### value

```ts
value: TValue;
```

##### values()

```ts
values(): IterableIterator<TValue>;
```

###### Returns

`IterableIterator`\<`TValue`\>

## Interfaces

### IEquatable

#### Type Parameters

| Type Parameter |
| ------ |
| `T` |

#### Methods

##### equals()

```ts
equals(other): boolean;
```

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `other` | `T` |

###### Returns

`boolean`
