get
Returns the value corresponding to the given key, or null if such a key is not present in the map.
Note that for maps supporting null values, the returned null value associated with the key is indistinguishable from the missing key, so containsKey should be used to check if the map actually contains the key.
Since Kotlin
1.3Samples
import kotlin.test.*
import java.util.*
fun main() {
//sampleStart
val map = mapOf(1 to "one", 2 to "two")
assertEquals("two", map[2])
assertNull(map[3])
//sampleEnd
}