A default map allows for a generator producing values automatically if you want to add something to a map that does not have a value associated with a given key. This does not implement the default map interface as return types (and some future methods may) change

Type Parameters

  • K
  • V = K

Constructors

  • Type Parameters

    • K
    • V = K

    Parameters

    • generator: ((k: K) => V)

      the generator to produce a default value for a given key

        • (k): V
        • Parameters

          Returns V

    • map: Map<K, V> = ...

      the initial map to start with

    Returns DefaultMap<K, V>

Methods

  • Iterates over all entries that have been set (explicitly or by the generator)

    Returns IterableIterator<[K, V], any, any>

  • Return a value for the given key, if the key does not exist within the default map, this will invoke the generator and assign the produced value.

    Parameters

    Returns V

  • returns only the keys really stored in the map

    Returns IterableIterator<K, any, any>

  • Sets a value for a given key. As you provide value, this does not invoke the generator!

    Parameters

    Returns this