Skip to content
academia.sh

Course Beginner

The Kotlin Language

Published Updated

By the end of this course

Start course

01

Language Basics

Kotlin's place on the JVM and its design goals, mutable and immutable declarations, basic types, string templates, control flow with the when expression and loops, functions with default and named parameters, lambdas and higher-order functions, and scope functions.

  1. 01 Kotlin's Place Introduces Kotlin's place on the JVM and its design goals; measures how the same `==` operator gives equality under four different criteria across eight values.
  2. 02 Variables Introduces declaration with `val` and `var`, type inference, and the `const val` constant; measures that the same string constant is a single object in two variables.
  3. 03 Basic Types Introduces the number types, the character, and the logical value; measures that the criterion of equality changes once a nullable `Int` is boxed.
  4. 04 String Templates Introduces string templates, raw strings, and the `trimIndent` function; measures that a string built with a template falls under the content criterion, while a single-variable template stays a singleton.
  5. 05 Control Flow Introduces the `if` and `when` expressions, the `is` check, and the `for` loop; measures that a `when` branch matches with `==` and does not hit for an ordinary class instance.
  6. 06 Functions Introduces parameters with default values, named arguments, and the `vararg` parameter; measures that a function reference gives a separate but equal object each time it is taken.
  7. 07 Lambdas and Higher-Order Functions Introduces lambda syntax, function types, and functions that take functions; measures that two lambda expressions are not equal, while a lambda that captures nothing is a single object.
  8. 08 Scope Functions Introduces the scope functions `let`, `run`, `with`, `apply`, and `also`; measures whether the receiver is `this` or `it` and what each returns, and shows that the result does not change the equality criterion.

02

Types and Null Safety

Nullable and non-nullable types, safe calls and the Elvis operator, primary and secondary constructors, data classes, sealed types and enumerations, object declarations, interfaces and delegation, extension functions, and generics and variance.

  1. 01 Null Safety A measurement of how nullable and non-nullable types are separate types, how a type narrows after a null check, and which criterion null equal to null produces.
  2. 02 Safe Calls and the Elvis Operator A measurement of where a safe call chain stops when it meets null, when the Elvis operator evaluates its right side, and which exception a not-null assertion throws.
  3. 03 Classes and Constructors A measurement of the execution order of the primary constructor, the init block, and the secondary constructor, and of why instances of a class without equals fall to the identity criterion.
  4. 04 Data Classes A measurement of the methods a data class generates from the properties in its primary constructor, of the separate object built with copy, and of how the type of a field affects the criterion.
  5. 05 Sealed Types and Enumerations A measurement of which criterion an enum entry, a data object, a data class, and an ordinary class fall to in the same sealed hierarchy, and of how an exhaustive when rejects a missing branch.
  6. 06 Object Declarations Measures the object declaration, the companion object, the `data object`, and the object expression with the criterion that makes two values equal, and shows that a declaration is a singleton while an expression builds a new object on every evaluation.
  7. 07 Interfaces and Delegation Measures the interface, the default implementation, and delegation with `by` using the criterion that makes two values equal, and shows that delegation forwards the members of the interface but does not forward `equals`.
  8. 08 Extension Functions Writes an extension function, an extension property, and an extension on a nullable receiver, and measures that an extension cannot shadow a member and is chosen by the static type.
  9. 09 Generics and Variance Measures a generic class, a generic function, an upper-bound constraint, `out` and `in` variance, and type erasure; shows that the type parameter is erased at run time and that equality looks at the value.

03

Collections and Concurrency Basics

Read-only and mutable collections, transformation operations with mapping, filtering and reduction, sequences, coroutines, flows, and the unchecked exception model.

  1. 01 Collection Types Measures that a read-only interface does not mean immutability, that a list's equality comes from its content, and that sets and maps compare equal regardless of order.
  2. 02 Transformation Operations Measures that mapping, filtering, folding and grouping produce new collections, that applying the same transformation twice gives equal but separate results, and that distinct and toSet rest on the element's own equality.
  3. 03 Sequences Measures that a sequence holds its intermediate operations until a terminal operation arrives and processes elements piece by piece, that it can be finished from an infinite source, and that two sequences are not counted as equal.
  4. 04 Coroutines Measures that a coroutine yields its turn at the point where it is suspended, that the result is taken with await, and that two separately started jobs are not counted as equal.
  5. 05 Flows Measures that a cold flow reruns on every collecting, that consecutive equal values are dropped by content, and that two flows are not counted as equal.
  6. 06 Exception Handling Measures the unchecked exception model, the try expression, Result and propagation in a coroutine, shows that two exceptions with the same message are not counted as equal, and closes the course.

Final exam

The Kotlin Language — Final Exam

In preparation

This course's question bank is not complete yet. The exam opens here automatically once enough questions are added.

Start typing to search.

↑↓ ↵ Esc navigate · open · close