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.

interface SetMultiMap<TKey, TVal> {
    [iterator]: (() => IterableIterator<[TKey, TVal]>);
    [toStringTag]: string;
    add: ((key: TKey, value: TVal | ReadonlySet<TVal>) => this);
    asMap: (() => ReadonlyMap<TKey, ReadonlySet<TVal>>);
    deleteEntry: ((key: TKey, value: TVal) => boolean);
    distinctKeys: (() => IterableIterator<TKey>);
    entries: (() => IterableIterator<[TKey, TVal]>);
    entrySets: (() => IterableIterator<[TKey, ReadonlySet<TVal>]>);
    forEach: ((callbackfn: ((value: TVal, key: TKey, map: SetMultiMap<TKey, TVal>) => void), thisArg?: unknown) => void);
    get: ((key: TKey) => undefined | ReadonlySet<TVal>);
    hasEntry: ((key: TKey, value: TVal) => boolean);
    size: number;
    valueSets: (() => IterableIterator<ReadonlySet<TVal>>);
    values: (() => IterableIterator<TVal>);
    clear(): void;
    delete(key: TKey): boolean;
    has(key: TKey): boolean;
    keys(): IterableIterator<TKey>;
    set(key: TKey, value: TVal | ReadonlySet<TVal>): this;
}

Type Parameters

  • TKey
  • TVal

Hierarchy

Implemented by

Properties

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

Iterates over all key/value bindings in this Map.

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

Adds the given key/value binding to the Map.

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

Returns a Readonly Map representation of this Map.

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

Deletes the given key/value binding from the Map.

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

Iterates over all distinct keys in this Map.

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

Iterates over all key/value bindings in this Map.

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

Iterates over all distinct keys in this Map, together with a Set of their values.

forEach: ((callbackfn: ((value: TVal, key: TKey, map: SetMultiMap<TKey, TVal>) => void), thisArg?: unknown) => void)

Loops over all key/value bindings.

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

Returns all values stored for the given key. Returns undefined if there are no values for this key.

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

Returns true if this key/value binding exists in the Map.

size: number

the number of elements in the Map.

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

Iterates over all distinct keys and returns their Set of values.

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

Iterates over all values in this Map.

Methods

  • Returns void

  • Parameters

    Returns boolean

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

  • Parameters

    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

    Returns this