Kotlin 2.x, KSP & Collections
KOTLIN › Modern Kotlin
Drills Kotlin 2.x's K2 compiler, KSP-over-kapt code generation, and collection semantics and variance.
Modern Android interviews probe whether you understand the K2 compiler rewrite, why KSP replaced kapt for annotation processing, and the subtle semantics of Kotlin collections. Expect questions on read-only vs mutable interfaces, List vs Array, generic variance, and emerging features like context parameters. These topics separate engineers who write Kotlin from those who actually understand how it compiles and behaves.
What this covers
- K2 compiler: FIR-based frontend rewrite, stable and default since Kotlin 2.0, with faster builds and smarter smart casts
- KSP vs kapt: why KSP is faster, its read-only symbol model, kapt being in maintenance mode, and KSP2 for K2
- Read-only vs mutable collection interfaces, and why read-only does NOT mean immutable
- List vs Array: fixed-size array (not a Collection) versus dynamically sized List backed by ArrayList
- Variance: covariant read-only collections versus invariant mutable collections, and why
- Context receivers/parameters as an experimental scoping feature and their current status
Study this topic
- Kotlin 2.x, KSP & Collections explained: the guided lesson
- 14 practice quiz questions
- 9 revision flashcards
- Kotlin 2.x, KSP & Collections interview questions and answers