withDefault
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 key specified and a value is obtained with Map.getValue function, for example when properties are delegated to the map.
When this map already has an implicit default value provided with a former call to withDefault , it is being replaced by this call.
@JvmName
(
"withDefaultMutable"
)
fun
<
K
,
V
>
MutableMap
<
K
,
V
>
.
withDefault
(
defaultValue
:
(
key
:
K
)
->
V
)
:
MutableMap
<
K
,
V
>
(source)
Returns a wrapper of this mutable 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 key specified and a value is obtained with Map.getValue function, for example when properties are delegated to the map.
When this map already has an implicit default value provided with a former call to withDefault , it is being replaced by this call.