Kotlin Core · 8 min read · Intermediate
Collections, Extension Functions & Lambdas
Transform lists concisely with `filter`, `map`, `sortedBy`, and custom Kotlin extension functions.
What you'll learn
- Chain `filter`, `map`, and `associateBy` cleanly
- Write focused extension functions (`fun String.toSlug()`) for reusable helpers
- Understand trailing lambda syntax (`items.forEach { ... }`)
Overview
Transform lists concisely with filter, map, sortedBy, and custom Kotlin extension functions.
Code Example
val completed = lessons
.filter { it.isDone }
.map { it.title }
.sorted()
Key Takeaways
- Chain
filter,map, andassociateBycleanly - Write focused extension functions (
fun String.toSlug()) for reusable helpers - Understand trailing lambda syntax (
items.forEach { ... })
Quick Check
Check Your Understanding
Score: 0 / 1
1. What type does `listOf("A", "B")` return in Kotlin?
Study Workspace
Finished this lesson?
Your progress is saved locally in your browser, no account needed.