KtKotlin · Lesson 5 of 8
Collections & Lambdas
filter, map, sumOf, groupBy — Kotlin's collection pipeline turns loop-heavy code into declarative one-liners. This style dominates real Android codebases.
✦ Tip
When a lambda is the last argument, it moves outside the parentheses — filter { ... } rather than filter({ ... }). That trailing-lambda rule is why Kotlin DSLs (Jetpack Compose, Gradle) look like built-in syntax.
When a lambda is the last argument, it moves outside the parentheses — filter { ... } rather than filter({ ... }). That trailing-lambda rule is why Kotlin DSLs (Jetpack Compose, Gradle) look like built-in syntax.