Section 1: Lab: Getting Started with Kotlin 2 and Its Tools
- How Kotlin runs on the JVM and where it improves on Java
- The K2 compiler and setting up a project in IntelliJ IDEA
- The Gradle Kotlin DSL and the structure of build.gradle.kts
- Call existing Java classes from Kotlin and the other way round
- Lab: convert short Java snippets to Kotlin
Section 2: Language Basics and Null Safety
- val and var, type inference and string templates
- if and when as expressions, ranges and loops
- Nullable types, safe calls (?.), the Elvis operator (?:) and smart casts
- Why to avoid the non-null assertion (!!)
- Lab: functions that check and convert data that may be null
Section 3: Functions, Classes and Data Classes
- Default and named arguments, and extension functions
- Classes, primary constructors and init
- Data classes for DTOs, with copy() and equals()
- Sealed classes and sealed interfaces for multiple result types
- object, companion objects and visibility modifiers
Section 4: Lab: Collections, Lambdas and Scope Functions
- Read-only and mutable List, Set and Map
- map, filter, flatMap, groupBy and associateBy
- Sequences for lazy processing of large data sets
- Scope functions: let, apply, also, run and with
- Lab: summarise order data with the collections API
Section 5: Error Handling and an Introduction to Coroutines
- Exceptions in Kotlin, runCatching and Result
- Model success and failure with sealed classes
- suspend functions and coroutine scopes
- Run several tasks concurrently with async and await
- Lab: fetch data from several sources at once and combine the results