I just announced the new Spring 5 modules in REST With Spring:


Kotlin is a new statically-typed language in the JVM world with a developer-friendly syntax and strong Java interoperability.

It’s now also a first-class language on the Android platform.

>> Introduction to Kotlin

Starting at the top – this is the high-level overview of the language, highlighting its most interesting features.

>> Null-Safety in Kotlin

Kotlin features a new modern approach to compile-time null-safety. Here, we explore it in depth.

>> Visibility Modifiers in Kotlin

Kotlin has his own set of visibility modifiers – some are borrowed directly from Java, some are not.

>> Kotlin’s Collections API

In this one, we introduce the Kotlin’s Collections API and go through its features.

>> Generics in Kotlin

Generics are slightly more flexible than in Java. We see how to use the out and in keywords properly. We look at type projections and defining a generic method that uses generic constraints.

>> Kotlin’s when {…} Block

Even though it’s not possible to do pattern matching using when in Kotlin, as is the case with the corresponding structures in Scala and other JVM languages, the when block is versatile enough to make us totally forget about these features.

>> Kotlin’s Data Classes

There’s also an easy way for creating plain data holders without writing any excessive boilerplate.

>> Kotlin’s Sealed Classes

Sealed classes can be an invaluable tool for your API design toolbox. Allowing a well-known, structured class hierarchy that can only ever be one of an expected set of classes can help remove a whole set of potential error conditions from your code, whilst still making things easy to read and maintain.

>> Kotlin’s Collections vs Stream API

Collections API has methods similar to those found in the Java Stream API but they do not always behave the same.

>> Destructuring Declarations in Kotlin

Here, we can see how to use destructuring declarations in Kotlin.

>> Kotlin’s Equality Operators

The approach to equality operators is slightly different than in Java.

>> Kotlin-Java Interoperability

If we want to mix Kotlin and Java code, we can do that easily.

>> @Tailrec Annotation

We can also easily optimize tail-recursive methods.

>> Kotlin’s Delegated Properties

Class properties do not always need to be backed back a field in a particular class, we can also delegate them.

>> Coroutines

Coroutines are a new, lightweight approach to concurrency.

>> Lazy Initialization in Kotlin

We delve into Kotlin lazy keyword that is used for lazy initialization of properties. In the end, we see how to defer assigning variables using the lateinit keyword.

>> Kotlin and Mockito

Here, we have a look at how to set up our project to use Mockito and Kotlin together, and how we can leverage this combination to create mocks and write effective unit tests.

>> List to Map

And finally, we explore different ways of converting a List to a Map in Kotlin.

I just announced the new Spring 5 modules in REST With Spring: