This project collects a series of small examples, to show how Kotlin can be used and how it can interoperate with Java.
The Book Kotlin in Action has been used as a reference for the examples, and the packages structure reflects the chapters in the book.
(The base package is com.ilozanof.kotlin.learning. All the packages contain a package-info.java with a description of the content, and the order on which you should follow the examples.)
-
basic: Basic use of Kotlin: Variables declaration, functions, Exceptions, loops, etc.
-
functions: Definition of functions: with or without a returning value, extended functions, extended properties, interoperability Java-Kotlin, working with Collections and Strings, varargs, infix calls, destructuring declarations, etc.
-
classes: Classes and interfaces. how to define constructors, inner classes and extend Classes/interfaces. How to make use of Kotlin features to implements some design patterns, using the "by" or "object" keywords. How to implement universal methods (toSting, hashCode, equals)
-
lambdas: Examples of the use of Lambda Expressions in Kotlin.
-
types: Examples of use of different types in Kotlin, how to handle Nullability and Late Init Properties.
-
overloading: Examples of overloading operators, desestructuring declarations and Delegated properties.
-
HighOrderFunctions: Examples of passing functions as a parameters, and how to use local-returns and no-local returns and anonymous functions in lambdas.