Skip to content

Glossary: Java Beyond the Basics

Optional

Also written: OptionalDouble, Optional.ofNullable, orElse, orElseThrow

A box that holds one value or nothing, returned instead of null so every caller knows to check first. Unwrap it with orElse, orElseThrow and similar methods.

Where the book teaches it

Related terms

StreamNullPointerException