setDefault

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

Create a new MapWithDefault from given map and for each unknown key, returns the value provided by defaultValue provider.


fun <K, V> MutableMap<K, V>.setDefault(defaultValue: (key: K) -> V): MutableMapWithDefault<K, V>

Create a new MutableMapWithDefault from given map and for each unknown key, returns the value provided by defaultValue provider.