Chapter 6. The Kotlin type system

This chapter covers

  • Nullable types and syntax for dealing with nulls
  • Primitive types and their correspondence to the Java types
  • Kotlin collections and their relationship to Java

By now, you’ve seen a large part of Kotlin’s syntax in action. You’ve moved beyond creating Java-equivalent code in Kotlin and are ready to enjoy some of Kotlin’s productivity features that can make your code more compact and readable.

Let’s slow down a bit and take a closer look at one of the most important parts of Kotlin: its type system. Compared to Java, Kotlin’s type system introduces several new features that are essential for improving the reliability of your code, such as support for nullable types and read-only collections ...

Get Kotlin in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.