Kotlin教程:MutableList接口

Kotlin MutableList是一个接口和通用的元素集合。 MutableList接口本质上是可变的。 它继承了Collection 类的形式。 MutableList接口的方法支持读写功能。 当MutableList中声明了元素,就可以添加更多元素或删除它们,因此MutableList没有固定的大小长度。

要使用MutableList接口,需要使用mutableListOf()mutableListOf ()函数。

MutableList的元素遵循插入顺序来排序,并与数组具有相同的索引号。

MutableList接口声明

interface MutableList : List, MutableCollection (source)