← Docs
kotlin-stdlib / kotlin.collections / Map / getOrDefault

getOrDefault

Common
JVM
JS
Native
1.1
open fun getOrDefault (
key : K ,
defaultValue : @UnsafeVariance V
) : V

(source)

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

Since JDK 1.8

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 .