contains Value
Требования к платформе и версии: Common (1.0), JS (1.1), JVM (1.0), Native (1.3), Wasm-JS (1.8), Wasm-WASI (1.8)
expect abstract fun containsValue(value: V): Boolean
Возвращает true, если карта сопоставляет один или несколько ключей указанному значению.
Примеры
import kotlin.test.*
import java.util.*
fun main() {
//sampleStart
val map = mapOf(1 to "one", 2 to "two")
println("map.containsValue(\"one\") is ${map.containsValue("one")}") // true
println("map.containsValue(\"1\") is ${map.containsValue("1")}") // false
//sampleEnd
}
© 2010–2026 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/contains-value.html