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

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.

主站蜘蛛池模板: 文水县| 乐亭县| 杂多县| 通榆县| 太湖县| 宿迁市| 石狮市| 抚远县| 阳城县| 嘉峪关市| 荣成市| 威海市| 曲周县| 商水县| 乌兰察布市| 南京市| 三江| 辰溪县| 赞皇县| 永川市| 南陵县| 项城市| 九龙县| 清徐县| 如东县| 三门县| 方城县| 聂拉木县| 耿马| 绥滨县| 德兴市| 临洮县| 焦作市| 孙吴县| 准格尔旗| 文成县| 南陵县| 四平市| 岳阳县| 中江县| 德庆县|