官术网_书友最值得收藏!

Collection types in Kotlin

One of the main Kotlin goals is Java interoperability. So it's no wonder that Kotlin collections are interoperable with Java. When you specify that your functions receives List<T>, it is actually the same Java List<T> you're familiar with.

But Kotlin differentiates between mutable and immutable collections. The listOf() function is delegated to Arrays.asList(), and produces an immutable list, while mutableListOf() simply calls ArrayList().

On top of data, Kotlin collection has many useful extension methods, which we'll discuss later.

主站蜘蛛池模板: 建湖县| 宁南县| 荆州市| 嘉鱼县| 两当县| 德昌县| 华宁县| 兴文县| 兴国县| 徐水县| 德令哈市| 清镇市| 太仓市| 宜章县| 宾阳县| 周口市| 厦门市| 五寨县| 河池市| 乐都县| 泸水县| 华池县| 丰都县| 开平市| 西华县| 冀州市| 巴中市| 崇阳县| 马关县| 利川市| 乐昌市| 丹寨县| 永春县| 建始县| 罗平县| 奎屯市| 鄯善县| 城固县| 南和县| 盘山县| 永吉县|