Kotlin教程:MutableList接口
Kotlin MutableList
是一个接口和通用的元素集合。 MutableList
接口本质上是可变的。 它继承了Collection
类的形式。 MutableList
接口的方法支持读写功能。 当MutableList
中声明了元素,就可以添加更多元素或删除它们,因此MutableList
没有固定的大小长度。
要使用MutableList
接口,需要使用mutableListOf()
或mutableListOf ()
函数。
MutableList
的元素遵循插入顺序来排序,并与数组具有相同的索引号。
MutableList接口声明
interface MutableList : List, MutableCollection (source)