To does not work the same as Pair()?


#1
mapOf<String, Any?>({"key" to "value"}) // Type mismatch
mapOf<String, Any?>(Pair("key", "value")) // fine

Can someone explain why?


#2

{"key" to "value"} is a lambda which receives 0 arguments and returns pair. You need to remove curly braces.