Kotlin Collections
Collections are a central part of Kotlin practice. Prefer immutable collections by default and mutate only when the use case justifies it.
Lists
val names = listOf("Ada", "Linus", "Kotlin")
Maps
val ages = mapOf("Ada" to 36, "Linus" to 55)
Sets
Sets are useful when uniqueness matters more than ordering. They are common in deduplication and membership checks.
Operations
Kotlin collection functions such as map, filter, and reduce keep transformation code compact and readable.
Practice
- Create one list, one map, and one set.
- Apply one filter or transform to a collection.
- Write one note about why immutable collections help review safety.