Class MultiMap<K, V>

A multimap is a variation of a Map that has potentially multiple values for every key.

Type Parameters

  • K
  • V

Constructors

Accessors

Methods

  • Operates differently depending on whether a value is given:

    • With a value, this method deletes the specific key / value pair from the multimap.
    • Without a value, all values associated with the given key are deleted.

    Parameters

    • key: K
    • Optionalvalue: V

    Returns boolean

    true if a value existed and has been removed, or false if the specified key / value does not exist.

  • Invokes the given callback function for every key / value pair in the multimap.

    Parameters

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

          • value: V
          • key: K
          • map: this

          Returns void

    Returns void

  • Returns an array of all values associated with the given key. If no value exists, an empty array is returned.

    Note: The returned array is assumed not to be modified. Use the set method to add a value and delete to remove a value from the multimap.

    Parameters

    • key: K

    Returns readonly V[]

  • Operates differently depending on whether a value is given:

    • With a value, this method returns true if the specific key / value pair is present in the multimap.
    • Without a value, this method returns true if the given key is present in the multimap.

    Parameters

    • key: K
    • Optionalvalue: V

    Returns boolean