Optionals

Utility methods for Optional, backporting Java 9+ operations to Java 8.

This class emulates Optional.or() chaining from Java 9+, allowing lazy evaluation of alternative Optional values.

Migration notice: Remove this class when upgrading to Java 11+. Replace Optionals.or() calls with native Optional.or() chaining.

Since

3.28.0

Functions

Link copied to clipboard
open fun <T> or(suppliers: Array<Supplier<Optional<T>>>): Optional<T>
Returns the first present Optional from the given suppliers.