Using set Syntax - listOf, mapOf and setOf returns read-only objects that you cannot add or remove items.
- If you want to add or remove items you have to use arrayListOf, hashMapOf, hashSetOf, linkedMapOf (LinkedHashMap), linkedSetOf (LinkedHashSet), mutableListOf (The Kotlin MultableList collection), mutableMapOf (The Kotlin MultableMap collection), mutableSetOf (The Kotlin MultableSet collection), sortedMapOf or sortedSetOf
- Each collection has methods like first(), last(), get() and lambda functions like filter, map, join, reduce and many others.
|