The Lord of Collection Functions: The Fellowship of Kotlin
summary
Walks through concrete Kotlin examples that replace imperative loops with actual collection functions, demonstrating replace forEach by using count (returns 1 for the apple holder), sumOf for ages, filter to pick hobbits, map for roll call, flatMap/flatten to list every item, zip to pair fighters, windowed/chunked for night shifts, groupBy for weapon types, and reduce/fold to pick a champion. Highlights practical caveats like fold safe, reduce unsafe on empty lists and shows flatMap combines map+flatten; code samples and repo links are provided.
AI-written summary · about
chapters (19)
- 0:00Introduction
- 3:02Meet Bendalf
- 4:04Imperative vs declarative
- 5:30The dark function
- 7:37Collection functions foundation
- 9:01Count and sum
- 10:23Any all none checks
- 11:27First last with predicates
- 12:32Filter explained
- 13:34Take drop map
- 16:28Intermediate operations
- 16:50Sorted by and with
- 20:19Flatten and flatMap
- 21:42Partition and groupBy
- 25:17Zip and windowed
- 27:03Chunked reduce fold
- 31:16Reduce and fold
- 35:04Mount Dallocation battle
- 36:33Conclusion
related talks
38mThe Lord of Collection Functions - The Fellowship of Kotlin
21mExplore Kotlin.Collections API
35mTreasure.map(): Functional Programming in Kotlin
51mBack to the Stdlib: Making the Most of Kotlin’s Standard Library
01h 01mTransforming Data using the Functional API
29mTreasure.map(): Functional Programming in Kotlin
45mKotlin - Advanced Tricks
57mIdiomatic Kotlin
