Kotlin HashMap getOrElse()
Syntax & Examples
Syntax of HashMap.getOrElse()
The syntax of HashMap.getOrElse() extension function is:
fun <K, V> Map<K, V>.getOrElse( key: K, defaultValue: () -> V ): V
This getOrElse() extension function of HashMap returns the value for the given key if the value is present and not null. Otherwise, returns the result of the defaultValue function.