updateAtIfPresent method

Map<K, V> updateAtIfPresent(
  1. Eq<K> eq,
  2. K key,
  3. V value
)

If the given key is present in the Map, then update its value to value. Otherwise, return a copy of the original unmodified Map.

Implementation

Map<K, V> updateAtIfPresent(
  Eq<K> eq,
  K key,
  V value,
) =>
    updateAt(eq, key, value).getOrElse(
      () => {...this},
    );