Collections for Kotlins
Kotlin collections are the standard library types List, Set and Map with their read-only and mutable variants, plus lazy Sequences and the scope functions let, run, with, apply and also. This area of the language covers how data is transformed in a functional style using operations like map, filter and groupBy.
Stage: Idiomatic Kotlin · Part of the Kotlin roadmap · Last reviewed 19 November 2026
What to learn in Collections
- Transform lists with map, filter, flatMap and groupBy instead of manual loops
- Choose between eager collection operations and lazy Sequences for large pipelines
- Aggregate data with fold, reduce, associate and partition
- Pick the right scope function based on receiver and return value
- Distinguish read-only collection interfaces from truly immutable data
Collections interview questions
When should you use a Sequence instead of a List?
Use a Sequence when a pipeline has several chained operations on a large collection, or when you only need the first few results. Sequences process elements one at a time and lazily, avoiding intermediate lists. For small collections, plain list operations are usually simpler and fast enough.
What is the difference between apply and also?
apply uses this as the receiver and returns the object itself, so it suits configuring an object. also passes the object as it and returns it too, so it suits side effects such as logging. Both return the original receiver, unlike let and run.
Where Collections fits in the Kotlin roadmap
Collections belongs to the Idiomatic Kotlin stage (intermediate level), which takes about 22 hours. Collections and DSLs.
Other units in this stage
Back to the full Kotlin roadmap