compute

fun compute(key: K, remappingFunction: (K, V?) -> V?): V?

Attempts to compute a mapping for the specified key and its current mapped value (or null if there is no current mapping). If the function returns null, the mapping is removed (or remains absent).

Throws

if the remapping function modifies this map