Table of contents

About Fundamental Series

  About me


    What is this book about?

    Who is this book for?

What is Kotlin?

  Basic characteristics

  Where is it used?

    Server-side development

    Android mobile development

    JavaScript development

    Some Kotlin project examples

Kotlin tools

  Kotlin Compiler

  Kotlin to JavaScript

  Kotlin to Native

  Supported build tools

How to start?

Creating a project

  Quick start from IntelliJ Idea

  Creating Kotlin Gradle project


Hello from Kotlin!

  From Java to Kotlin

  Basic Syntax


    Defining functions

    Local values


    String templates

    Conditional expressions

    Working with nulls

    Type checks and smart casts

    For iteration

    While loop

    When expression



    Mutable collections

    Accessing members

    Iterating through collections

    Filter map


    Flat Map

    Max and min



    Group by




    Data classes

    Default arguments

    Traversing a map

    Lazy initialization

    Extending functionalities

    If not null shorthands

    Try / Catch

    If expression

    Single-expression functions

    Calling methods on an object instance using ‘with’

  Basic types

    Numbers in Kotlin

    Characters in Kotlin

    Booleans in Kotlin

    Arrays in Kotlin

    Strings in Kotlin

  Control flow

    If expression


    While and Do..While

    Jump operators

    Jump operator labels

    Return with labels

Working with objects



    Secondary constructors





    Class companion object

    Sealed classes

  Class properties


  Visibility modifiers


    Extending class properties

    Extending companion object

  Data classes


  Generic functions

  Java’s ‘EXTENDS’

  Nested classes

  Inner classes


  Kotlin Object


  Delegating behavior

  Delegating properties

  Property Delegation Requirements

  Standard Delegates



  Storing Properties in a Map

Functions and Lambdas

  Working with Functions

    Passing Arguments

    Named Arguments


    Single-Expression functions

    Variable argument functions

    Local functions

  Generic Functions

  Tail-recursive functions

Higher-Order Functions and Lambdas

  Higher-Order Functions

  Lambda Expressions and Anonymous Functions

  Function Types

  Lambda Expression Syntax

  Anonymous Functions


Inline Functions




  Type Checks and Casts



  Operator overloading