alllex
12/16/2020, 3:34 PMget
operator in kotlin is strictly typed)
fun main() {
val intList: List<Int> = listOf(1, 2)
val stringMap: Map<String, String> = mapOf("abc" to "xyz")
val x = intList.associateWith { map[it] } // should be an error, because key is String, and not Int
println(x)
}
Kotlin: 1.4.21ilya.gorbunov
12/16/2020, 3:47 PMalllex
12/16/2020, 3:47 PMalllex
12/16/2020, 3:52 PM