W3cubDocs

/Kotlin

getOrDefault

Platform and version requirements: JVM (1.2), JRE8 (1.2)
fun <K, V> Map<out K, V>.getOrDefault(
    key: K, 
    defaultValue: V
): V

Returns the value to which the specified key is mapped, or defaultValue if this map contains no mapping for the key.

© 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/get-or-default.html