# Class ObservableSet<T>

A Set that supports observability.

#### Type Parameters

- T

#### Hierarchy

- Evented<this> & ObservableMixin<this>
  - ObservableSet

#### Implements

- Set<T>

#####
Index

### Constructors

constructor

### Properties

_originalSet
[toStringTag]
@eventTypes

### Accessors

size

### Methods

[iterator]
add
addMany
clear
delete
deleteMany
entries
forEach
has
keys
toJSON
values

##
Constructors

### constructor

- new ObservableSet<T>(): ObservableSet<T>

- #### Type Parameters

  - T

  #### Returns ObservableSet<T>

  Overrides observable(Evented).constructor

##
Properties

### `Protected`_originalSet

_originalSet: Set<T>

The underlying set that this class is wrapping.

### `Readonly`[toStringTag]

[toStringTag] = "ObservableSet"

Used by Object.toString().

Implementation of Set.[toStringTag]

### @eventTypes

@eventTypes: SetEvents<T>

#### Deprecated

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

Overrides observable(Evented).@eventTypes

##
Accessors

### size

- get size(): number

- The number of elements in the set.

  #### Returns number

  Implementation of Set.size

##
Methods

### [iterator]

- [iterator](): SetIterator<T>

- Returns each element in the set in insertion order.

  #### Returns SetIterator<T>

  Implementation of Set.[iterator]

### add

- add(value): this

- Adds an element to the set.

  #### Parameters

  - value: T

    The value to add.

  #### Returns this

  Implementation of Set.add

### addMany

- addMany(values): this

- Adds elements to the set.

  #### Parameters

  - values: Iterable<T, any, any>

    The values to add.

  #### Returns this

### clear

- clear(): void

- Removes all elements.

  #### Returns void

  Implementation of Set.clear

### delete

- delete(value): boolean

- Removes the specified element.

  #### Parameters

  - value: T

    The element to remove.

  #### Returns boolean

  True if an element was deleted, otherwise false.

  Implementation of Set.delete

### deleteMany

- deleteMany(values): boolean

- Removes the specified elements.

  #### Parameters

  - values: Iterable<T, any, any>

    The elements to remove.

  #### Returns boolean

  True if an element was deleted, otherwise false.

### entries

- entries(): SetIterator<[T, T]>

- Returns each element in the set in insertion order.

  #### Returns SetIterator<[T, T]>

  Implementation of Set.entries

### forEach

- forEach(callbackfn, thisArg?): void

- Executes a provided function once per each element in the set.

  #### Parameters

  - callbackfn: ((value: T, value2: T, set: Set<T>) => void)

    Function to execute for each element.

    - - (value, value2, set): void

      - #### Parameters

        - value: T
        - value2: T
        - set: Set<T>

        #### Returns void

  - `Optional` thisArg: unknown

    Value to use as `this` when executing callback.

  #### Returns void

  Implementation of Set.forEach

### has

- has(value): boolean

- Indicates whether or not the set contains the specified element.

  #### Parameters

  - value: T

    The element to test for.

  #### Returns boolean

  Implementation of Set.has

### keys

- keys(): SetIterator<T>

- Returns each element in the set in insertion order.

  #### Returns SetIterator<T>

  Implementation of Set.keys

### toJSON

- toJSON(): unknown

- Returns a serializable representation of the set.

  #### Returns unknown

### values

- values(): SetIterator<T>

- Returns each element in the set in insertion order.

  #### Returns SetIterator<T>

  Implementation of Set.values