Table of contents

About Fundamental Series

  About me

  Preface

    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

Basics

Hello from Kotlin!

  From Java to Kotlin

  Basic Syntax

    Packages

    Defining functions

    Local values

    Comments

    String templates

    Conditional expressions

    Working with nulls

    Type checks and smart casts

    For iteration

    While loop

    When expression

    Ranges

    Collections

    Mutable collections

    Accessing members

    Iterating through collections

    Filter map

    Predicates

    Flat Map

    Max and min

    Sorting

    Sum

    Group by

    Partition

    Fold

  Idioms

    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

    For

    While and Do..While

    Jump operators

    Jump operator labels

    Return with labels

Working with objects

  Classes

    Constructors

    Secondary constructors

    Members

    Inheritance

    Overriding

    Abstraction

    Class companion object

    Sealed classes

  Class properties

  Interfaces

  Visibility modifiers

  Extensions

    Extending class properties

    Extending companion object

  Data classes

  Generics

  Generic functions

  Java’s ‘EXTENDS’

  Nested classes

  Inner classes

  Enumeration

  Kotlin Object

  Singleton

  Delegating behavior

  Delegating properties

  Property Delegation Requirements

  Standard Delegates

    Lazy

    Observable

  Storing Properties in a Map

Functions and Lambdas

  Working with Functions

    Passing Arguments

    Named Arguments

    Unit

    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

  Closures

Inline Functions

Misc

  Destructuring

  Ranges

  Type Checks and Casts

  This

  Equality

  Operator overloading

  Exceptions

Summary

Literature