Kotlin HashMap orEmpty()
Syntax & Examples


Syntax of HashMap.orEmpty()

The syntax of HashMap.orEmpty() extension function is:

fun <K, V> Map<K, V>?.orEmpty(): Map<K, V>

This orEmpty() extension function of HashMap returns the Map if its not null, or the empty Map otherwise.