modifyAtIfPresent method

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

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

Otherwise, return a copy of the original unmodified Map.

Implementation

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