Interface SetMultiMap<TKey, TVal>

A SetMultiMap is a Map where a single key can have multiple unique values. Deleting a key removes all bindings with this key from the Map. Setting a value for a key replaces all previous bindings with this key. Using an empty Set when calling the set function is the same as deleting that key.

Type Parameters

  • TKey

  • TVal

Hierarchy

  • Map<TKey, TVal | ReadonlySet<TVal>>
    • SetMultiMap

Implemented by

Properties

[iterator]: (() => IterableIterator<[TKey, TVal]>)

Type declaration

    • (): IterableIterator<[TKey, TVal]>
    • Iterates over all key/value bindings in this Map.

      Returns IterableIterator<[TKey, TVal]>

[toStringTag]: string
add: ((key, value) => SetMultiMap<TKey, TVal>)

Type declaration

    • (key, value): SetMultiMap<TKey, TVal>
    • Adds the given key/value binding to the Map.

      Parameters

      • key: TKey
      • value: TVal | ReadonlySet<TVal>

      Returns SetMultiMap<TKey, TVal>

asMap: (() => ReadonlyMap<TKey, ReadonlySet<TVal>>)

Type declaration

    • (): ReadonlyMap<TKey, ReadonlySet<TVal>>
    • Returns a Readonly Map representation of this Map.

      Returns ReadonlyMap<TKey, ReadonlySet<TVal>>

deleteEntry: ((key, value) => boolean)

Type declaration

    • (key, value): boolean
    • Deletes the given key/value binding from the Map.

      Parameters

      • key: TKey
      • value: TVal

      Returns boolean

distinctKeys: (() => IterableIterator<TKey>)

Type declaration

    • (): IterableIterator<TKey>
    • Iterates over all distinct keys in this Map.

      Returns IterableIterator<TKey>

entries: (() => IterableIterator<[TKey, TVal]>)

Type declaration

    • (): IterableIterator<[TKey, TVal]>
    • Iterates over all key/value bindings in this Map.

      Returns IterableIterator<[TKey, TVal]>

entrySets: (() => IterableIterator<[TKey, ReadonlySet<TVal>]>)

Type declaration

    • (): IterableIterator<[TKey, ReadonlySet<TVal>]>
    • Iterates over all distinct keys in this Map, together with a Set of their values.

      Returns IterableIterator<[TKey, ReadonlySet<TVal>]>

forEach: ((callbackfn, thisArg?) => void)

Type declaration

    • (callbackfn, thisArg?): void
    • Loops over all key/value bindings.

      Parameters

      • callbackfn: ((value, key, map) => void)
          • (value, key, map): void
          • Parameters

            Returns void

      • Optional thisArg: any

      Returns void

get: ((key) => undefined | ReadonlySet<TVal>)

Type declaration

    • (key): undefined | ReadonlySet<TVal>
    • Returns all values stored for the given key. Returns undefined if there are no values for this key.

      Parameters

      • key: TKey

      Returns undefined | ReadonlySet<TVal>

hasEntry: ((key, value) => boolean)

Type declaration

    • (key, value): boolean
    • Returns true if this key/value binding exists in the Map.

      Parameters

      • key: TKey
      • value: TVal

      Returns boolean

size: number

Returns

the number of elements in the Map.

valueSets: (() => IterableIterator<ReadonlySet<TVal>>)

Type declaration

    • (): IterableIterator<ReadonlySet<TVal>>
    • Iterates over all distinct keys and returns their Set of values.

      Returns IterableIterator<ReadonlySet<TVal>>

values: (() => IterableIterator<TVal>)

Type declaration

    • (): IterableIterator<TVal>
    • Iterates over all values in this Map.

      Returns IterableIterator<TVal>

Methods

  • Returns void

  • Parameters

    • key: TKey

    Returns boolean

    true if an element in the Map existed and has been removed, or false if the element does not exist.

  • Parameters

    • key: TKey

    Returns boolean

    boolean indicating whether an element with the specified key exists or not.

  • Returns an iterable of keys in the map

    Returns IterableIterator<TKey>

  • 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: TKey
    • value: TVal | ReadonlySet<TVal>

    Returns SetMultiMap<TKey, TVal>