Modern Java Features in Java

Lessons in this section

  1. Optional

    Handle missing values safely with Optional: create one with of, ofNullable and empty, then use isPresent, ifPresent, orElse and orElseGet.

  2. Pattern Matching

    Check a value's type and use it in one step with pattern matching for instanceof and switch, including guards, null cases and record patterns.