contains
Returns true
if element is found in the array.
Returns true
if element is found in the collection.
Checks if the map contains the given key.
This method allows to use the x in map
syntax for checking whether an object is contained in the map.
Samples
import samples.*
import kotlin.test.*
import java.util.*
fun main() {
//sampleStart
val map: Map<String, Int> = mapOf("x" to 1)
assertTrue(map.contains("x"))
assertTrue("x" in map)
assertFalse(map.contains("y"))
assertFalse("y" in map)
//sampleEnd
}