containsKey

open override fun containsKey(key: K): Boolean(source)

Returns true if the map contains the specified key.

Since Kotlin

1.1

Samples

import kotlin.test.*
import java.util.*

fun main() { 
   //sampleStart 
   val map = mapOf(1 to "one", 2 to "two")
println("map.containsKey(1) is ${map.containsKey(1)}") // true
println("map.containsKey(-1) is ${map.containsKey(-1)}") // false 
   //sampleEnd
}