kotlin.collections.withDefault

withDefault

fun <K, V> Map<K, V>.withDefault(
    defaultValue: (key: K) -> V
): Map<K, V>

Returns a wrapper of this read-only map, having the implicit default value provided with the specified function defaultValue.

This implicit default value is used when the original map doesn't contain a value for the k