The Missing
Kotlin Reference
Learn to program in Kotlin, starting from the basics.
Part 1: Writing Kotlin
From one download to a real program, using the tools Kotlin actually gives you.
- 1Installing IntelliJ, and your first projectcoming soonOne download. A JDK and the Kotlin compiler come with it.
- 2Your first program, and your first red squigglecoming soonmain, println, the Run window, and the command IntelliJ really ran.
- 3val, var, and types you rarely writecoming soonImmutable by default, and what type inference is doing for you.
- 4Stringscoming soonTemplates, raw strings, and the standard library that comes with text.
- 5Numberscoming soonInt, Long, Double, and Kotlin refusing to widen one into another for you.
- 6Reading inputcoming soonAsking the reader a question, and the type Kotlin hands back.
- 7Null safetycoming soonWorking with a value that might not be there, without pretending it always is.
- 8Deciding thingscoming soonif is an expression here, and when is what you reach for instead.
- 9Loops and rangescoming soonCounting up, counting down, and stepping through a range.
- 10Functionscoming soonDefault arguments, named arguments, and functions that fit on one line.
- 11Debuggingcoming soonA wrong answer with no error, and the tools for finding out why.
- 12Listscoming soonHolding many values, and the difference between reading one and changing it.
- 13Transforming collectionscoming soonDescribing what you want from a list instead of looping over it.
- 14Maps and setscoming soonLooking something up by name, and the answer that might not exist.
- 15Data classescoming soonTwenty lines you do not write, and how to go and look at them.
- 16Classes and propertiescoming soonBuilding your own types, and why Kotlin has properties instead of fields.
- 17Sealed classescoming soonDescribing every state a thing can be in, and the compiler holding you to it.
- 18Errorscoming soonWhat happens when something goes wrong, and deciding what to do about it.
- 19Filescoming soonReading and writing a file, so a program survives being closed.
- 20Extension and scope functionscoming soonThe idioms that make Kotlin code look like Kotlin.
- 21Splitting a program upcoming soonPackages, several files, and deciding what the rest of the program may see.
- 22Build something realcoming soonNo new syntax. One project, built in stages, using everything so far.
Part 2: Lifting the floor
What is underneath the language you have been writing, and why it is shaped this way.
- 23What actually runs your Kotlincoming soonThe JVM, class files, and reading the bytecode your own code compiles to.
- 24References and identitycoming soonTwo names for one thing, and the difference between equal and the same.
- 25Memory and garbage collectioncoming soonNothing to free, and the leaks that happen anyway.
- 26Where null came fromcoming soonThe Java underneath, platform types, and why !! is in the language at all.
- 27Boxingcoming soonInt, Integer, and what a nullable number quietly costs.
- 28Genericscoming soonWriting code that works for any type, and what the JVM forgets at runtime.
- 29Interfaces, objects and delegationcoming soonSharing behaviour between types, and handing a job to someone else.
- 30Sequences versus collectionscoming soonThe chain of five operations that quietly built five lists.
- 31Gradlecoming soonThe build file that has been sitting in your project since chapter 1.
- 32Coroutinescoming soonDoing more than one thing at once, and the first library the book adds.
- 33Where to go nextcoming soonAndroid, the server, multiplatform, and what this book left out on purpose.