Class Dictionary<T, U>

A wrapper class for an associative array with object keys.

Note: This implementation uses ObjectIdentity to turn object keys into strings.

Type Parameters

Constructors

Properties

Methods

Constructors

Properties

map: Record<string, U> = {}

Stores the (key, value) pairs in this dictionary.

Methods

  • Returns the value for the given key.

    Parameters

    • key: T

    Returns null | NonNullable<U>

  • Stores the value under the given key and returns the previous value for that key.

    Parameters

    • key: T
    • value: U

    Returns null | NonNullable<U>

  • Removes the value for the given key and returns the value that has been removed.

    Parameters

    • key: T

    Returns null | NonNullable<U>

  • Visits all entries in the dictionary using the given function with the following signature: (key, value)=> where key is a string and value is an object.

    Parameters

    • visitor: Visitor<string, U>

      A function that takes the key and value as arguments.

    Returns void