构造数组

与Array构造器类似,现在有两种方式创建List和MutableList,并且通过lambda表达式进行初始化。

val squares = List(10) { index -> index * index }
val mutable = MutableList(10) { 0 }

results matching ""

    No results matching ""