# Class ObservableMap<K, V>

A Map that supports observability.

#### Type Parameters

- K
- V

#### Hierarchy (view full)

- Evented<this> & ObservableMixin<this> & HandlesMixin<void, this>
  - ObservableMap
    - CaseInsensitiveObservableMap
    - ReadOnlyMap

#### Implements

- Map<K, V>

#####
Index

### Constructors

constructor

### Properties

_handles
_originalMap
[toStringTag]
@eventTypes

### Accessors

size

### Methods

[iterator]
clear
delete
destroy
entries
forEach
get
has
keys
set
toJSON
values

##
Constructors

### constructor

- new ObservableMap<K, V>(): ObservableMap<K, V>

- #### Type Parameters

  - K
  - V

  #### Returns ObservableMap<K, V>

  Overrides handles(observable(Evented)).constructor

##
Properties

### `Protected` `Readonly`_handles

_handles: Handles<unknown, ResourceHandle>

Inherited from handles(observable(Evented))._handles

### `Protected`_originalMap

_originalMap: ObservableMap<K, V> | Map<K, V>

The underlying map that this object is delegating to.

### `Readonly`[toStringTag]

[toStringTag] = "ObservableMap"

Used by Object.toString().

Implementation of Map.[toStringTag]

### @eventTypes

@eventTypes: MapEvents<K, V>

#### Deprecated

Do not directly reference this property. Use EventNames and EventTypes helpers from @arcgis/core/Evented.

Overrides handles(observable(Evented)).@eventTypes

##
Accessors

### size

- get size(): number

- The number of elements.

  #### Returns number

  Implementation of Map.size

##
Methods

### [iterator]

- [iterator](): MapIterator<[K, V]>

- Returns the `[key, value]` pairs for each element in the map in insertion order.

  #### Returns MapIterator<[K, V]>

  Implementation of Map.[iterator]

### clear

- clear(): void

- Removes all elements.

  #### Returns void

  Implementation of Map.clear

### delete

- delete(key): boolean

- Removes the specified element.

  #### Parameters

  - key: K

    The element's key.

  #### Returns boolean

  True if an element was deleted, otherwise false.

  Implementation of Map.delete

### destroy

- destroy(): void

- #### Returns void

  Inherited from handles(observable(Evented)).destroy

### entries

- entries(): MapIterator<[K, V]>

- Returns the `[key, value]` pairs for each element in the map in insertion order.

  #### Returns MapIterator<[K, V]>

  Implementation of Map.entries

### forEach

- forEach(callbackfn, thisArg?): void

- Executes a provided function once per each key/value pair in the map.

  #### Parameters

  - callbackfn: ((value: V, key: K, map: Map<K, V>) => void)

    Function to execute for each element.

    - - (value, key, map): void

      - #### Parameters

        - value: V
        - key: K
        - map: Map<K, V>

        #### Returns void

  - `Optional` thisArg: unknown

    Value to use as `this` when executing callback.

  #### Returns void

  Implementation of Map.forEach

### get

- get(key): V

- Returns a specified element from the Map object. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Map.

  #### Parameters

  - key: K

  #### Returns V

  Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.

  Implementation of Map.get

### has

- has(key): boolean

- Indicates whether or not an element with the specified key exists.

  #### Parameters

  - key: K

    The key to test for.

  #### Returns boolean

  Implementation of Map.has

### keys

- keys(): MapIterator<K>

- Returns the keys for each element in the map in insertion order.

  #### Returns MapIterator<K>

  Implementation of Map.keys

### set

- set(key, value): this

- Adds a new element with a specified key and value to the Map. If an element with the same key already exists, the element will be updated.

  #### Parameters

  - key: K
  - value: V

  #### Returns this

  Implementation of Map.set

### toJSON

- toJSON(): unknown

- Returns a serializable representation of the map.

  #### Returns unknown

### values

- values(): MapIterator<V>

- Returns the values for each element in the map in insertion order.

  #### Returns MapIterator<V>

  Implementation of Map.values