Ruckus
01/22/2019, 9:10 PMval people = mapOf("a" to Person("Fred"), "b" to Person("George"))
val fred = people["a"]
Shawn
01/22/2019, 9:13 PMList<Pair>
structure. It’s a terrible idea but it’s possible.
val fred = people.first { it.first = "a" }.second
It’s really the only reason I’d consider the two constructs even comparable for this kind of question 😕Ruckus
01/22/2019, 9:14 PMShawn
01/22/2019, 9:16 PM"look up"
in quotes for a good reason - you’re right that the difference is very important. I just don’t know why else someone would compare the two.Ruckus
01/22/2019, 9:16 PMShawn
01/22/2019, 9:17 PMfebs
01/22/2019, 9:46 PMAlan Evans
01/22/2019, 9:47 PMarve
01/23/2019, 12:08 AMmapOf
function takes vararg of pairs
to construct a map - perhaps that's where the confusion stems from? 🙂fun <K, V> mapOf(vararg pairs: Pair<K, V>): Map<K, V>