Leveraging Null safety

NullPointerException is the most dreaded exception a developer can face when working with Java language. Sometimes it's quite difficult to trace and resolve it. Kotlin comes with a built-in Null safety system that is aimed at eliminating the null references from code:

The null references are famously known as The Billion Dollar Mistake (https://en.wikipedia.org/wiki/Tony_Hoare#Apologies_and_retractions) as their inventor later called it.

This Null safety system by Kotlin makes the whole Spring Framework API null safe (at least from the Kotlin side) and allows us to deal with null values at compile time rather than throwing NullPointerException at the runtime:

Kotlin's Null safety also means that the web apps you build ...

Get Kotlin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.