MutableList和Kotlin中的List之间的区别 [英] Difference between MutableList and List in Kotlin
本文介绍了MutableList和Kotlin中的List之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
- Kotlin中的 MutableList 和 List 有什么区别?
- 以及每种类型的用途是什么?
- What is the difference between MutableList and List in Kotlin?
- and what is the use of each type?
推荐答案
来自文档:
列表:元素的一般有序集合.该接口中的方法仅支持对列表的只读访问;请参见图11.通过MutableList接口支持读/写访问.
List: A generic ordered collection of elements. Methods in this interface support only read-only access to the list; read/write access is supported through the MutableList interface.
MutableList :元素的通用有序集合,支持添加和删除元素.
MutableList: A generic ordered collection of elements that supports adding and removing elements.
您可以修改MutableList:更改,删除,添加...其元素.在列表中,您只能阅读它们.
You can modify a MutableList: change, remove, add... its elements. In a List you can only read them.
这篇关于MutableList和Kotlin中的List之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文