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()) {

}

 

posted on 2017-10-12 12:43  tianlunte  阅读(245)  评论(0)    收藏  举报