Map values extensions: set and compare

Tried to set current map values to new but didn’t found a method. All I got is val can't be set. So, it took 2 methods to do the thing:

        map.putAll(map.mapValues {
            Random.nextInt(1, 10)
        })

The next case is to compare 2 values of the same map. There is no method, need to make an extension for it like

map.compareValues(key1, key2)
fun <T> MutableMap<T, Int>.compare(key1: T, key2: T) = compareValues(this[key1], this[key2])

That is by design. Map is a read-only interface. You want a MutableMap if you are modifying it

I don’t know what the first half is really asking for (why are you combining putAll and mapValues, what use case?), but the second half I think is obscure enough that it doesn’t really warrant a stdlib method.