
-

Welcome
Thanks for purchasing the MEAP for Kotlin in Action! We're looking forward to
introducing you to Kotlin, which is a new programming language that is a pragmatic, safe,
concise, and interoperable alternative to Java. With Kotlin, you can implement your
projects with less code, a higher level of abstraction, and fewer annoyances.
We assume that you're already familiar with Java, either as a server-side developer or as
an Android application developer. Switching from Java to Kotlin is a smooth process that
does not involve a steep learning curve, and there are many tools that can help. We expect
that it won't take you long to become productive with the language.
One of the strong points of Kotlin is its strong interoperability with Java. If you want to
try Kotlin for yourself, you can do this in a new project, but you also have an option of
introducing it into your existing Java codebase. You can also easily try features of the
language in an interactive console or an online playground.
The book consists of three parts. The first part will teach you the basic syntax of the
language. The second part will focus on features that allow you to build reusable
abstractions, higher-level functions, libraries, and even entire domain specific languages.
Finally, the third part will focus on details of applying Kotlin in real-world projects, such as
build system integration, Android support and concurrent programming.
Both of us have been part of the team working on Kotlin for the past five years, so you
can be confident that you're receiving authoritative information straight from the source.
Even though version 1.0 is out, Kotlin is continuing to evolve, so we’ll ensure that the
information in the MEAP book always corresponds to the current state of the language.
We're looking forward to your feedback on the text that we have so far. If anything is
confusing, unclear or seems to be missing entirely, please don't hesitate to leave your
comments in the Author Online forum.
—
Dmitry Jemerov and Svetlana Isakova

brief contents
PART 1: INTRODUCTION
1
Kotlin : What and Why
2
Kotlin basics
3
Defining and Calling Functions
4
Classes, Objects,and Interfaces
5
Programming with lambdas
6
The Kotlin Type System
P
ART
2: E
MBRACING
K
OTLIN
7
Operator Overloading and Other Conventions
8
Higher-Order Functions : Lambdas as Parameters and
Return Values
9
Generics
10
Annotations and Reflection
11
DSL Construction
APPENDIXES:
A Building Kotlin
projects B
Documenting