W3cubDocs

/Kotlin

getOrDefault

Platform and version requirements: JVM (1.1), JS (1.1), Native (1.1)
open fun getOrDefault(
    key: K, 
    defaultValue: @UnsafeVariance V
): V

Returns the value corresponding to the given key, or defaultValue if such a key is not present in the map.

Since JDK 1.8

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-map/get-or-default.html