Kotlin Collections/Maps
1. setOf, hashSetOf, arrayListOf
2. hashMapOf
val map = hashMapOf(1 to "A", 2 to "B", 3 to "C")
3. 语法糖
val list = listOf(1, 10, 100, 99) val maxItem = list.max() val lastItem = list.last()
for ((index, item) in list.withIndex()) { }
浙公网安备 33010602011771号