Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Kotlin

Optional API

Source: https://4comprehension.com/kotlins-java-util-optional-equivalents/

val x: Int? = 7     // ofNullable()

val result = x
?.let { ...  }      // map()
?.takeIf { ...  }   // filter()
?: 42               // orElseGet()
Last change: 2024-10-02, commit: f21761c