modifyAtIfPresent method

Map<K, V> Function(K key, V (V value)) modifyAtIfPresent(
  1. Eq<K> eq
)

If the given key is present in the Map, then modify its value using modify and return a the new Map. Otherwise, return the original unmodified Map.

Implementation

Map<K, V> Function(K key, V Function(V value)) modifyAtIfPresent(Eq<K> eq) =>
    (K key, V Function(V value) modify) =>
        modifyAt(eq)(key, modify).getOrElse(() => this);