Skip to content

Kotlin

This section covers the Kotlin language features most relevant to Android and JVM development: null-safety, type modeling, functions, collections, generics, initialization, and Java interoperability.

For a practical learning path, start with the language basics, then continue with classes, functions, and collections. Study generics once type relationships are familiar, and use the initialization and Java interoperability articles to understand common Android boundaries.

Language foundations

  • Basics - variables, null-safety, core types, equality, casts, and inheritance rules.
  • Classes & Types - data, sealed, object, companion, and value classes and their runtime trade-offs.
  • Functions - extensions, function types, scope functions, inlining, and non-local returns.

Collections and reusable APIs

  • Collections - read-only and mutable collections, transformations, sequences, and key stability.
  • Generics - variance, projections, upper bounds, type erasure, and reified type parameters.

Initialization and interoperability

  • lateinit vs lazy - deferred initialization, safety checks, and thread-safety modes.
  • Kotlin vs Java - nullability, visibility, properties, annotations, inheritance, and JVM interoperability.