Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Nullability In Kotlin

Nullability In Kotlin

This is a presentation about null safety in Kotlin. Basically, an overview of the history of the "null reference", how Kotlin has been designed to handle it. And a few cool tools Kotlin offers to handle absence of values safely.

Michael Bukachi

September 14, 2019

Transcript

17 slides
  1. Nullability Null Reference: • Created in 1964 • Later introduced

    into JAVA (every object can be null • Billions of dollars have been spent to handle and fix errors it introduces
  2. Nullability public static void main(String[] args) { String string1 =

    ""; String string2 = null; } What’s wrong with this picture?
  3. Nullability So what’s in the toolbox: • ?. - Null-safe

    operator • !! - Non-null assertion • ?.let - Null safe lambdas • ?: - Elvis operator • as? - Safe casting

More Decks by Michael Bukachi

Other Decks in Technology