← Docs
kotlin-stdlib / kotlin.collections / getOrDefault

getOrDefault

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

(source)

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

Stay in touch:
  • Contributing to Kotlin
  • Releases
  • Press Kit
  • Security
  • Blog
  • Issue Tracker
  • Brand assets
  • Careers
Supported and developed by JetBrains .
Kotlin™ is protected under the Kotlin Foundation
and licensed under the Apache 2 license .