- java.lang.Object
-
- com.aoapps.lang.function.Suppliers
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Optional<T>coalesce(Supplier<? extends T>... suppliers)Lazily evaluates a set of suppliers, returning the first non-null result orOptional.EMPTYwhen no result.static <T,Ex extends Throwable>
Optional<T>coalesceE(SupplierE<? extends T,? extends Ex>... suppliers)Lazily evaluates a set of suppliers, returning the first non-null result orOptional.EMPTYwhen no result.
-
-
-
Method Detail
-
coalesce
public static <T> Optional<T> coalesce(Supplier<? extends T>... suppliers)
Lazily evaluates a set of suppliers, returning the first non-null result orOptional.EMPTYwhen no result.- Returns:
- The first non-null result or
Optional.EMPTYwhen all returnnull
-
coalesceE
public static <T,Ex extends Throwable> Optional<T> coalesceE(SupplierE<? extends T,? extends Ex>... suppliers) throws Ex extends Throwable
Lazily evaluates a set of suppliers, returning the first non-null result orOptional.EMPTYwhen no result.- Returns:
- The first non-null result or
Optional.EMPTYwhen all returnnull - Throws:
Ex extends Throwable
-
-