Supplier

A functional interface whose get method takes no arguments and returns a value, used to produce something on demand.

In more detail

orElseGet runs its supplier only when the Optional is empty, and CompletableFuture.supplyAsync runs one on another thread. Passing a supplier instead of a value lets the callee decide whether and when to compute it.

Example

() -> "ready"

Related terms

Taught in

References

Certification courses