Class Suppliers

java.lang.Object
com.aoapps.lang.function.Suppliers

public final class Suppliers extends Object
Utilities for working with Supplier and SupplierE.
See Also:
  • Method Details

    • coalesce

      public static <T> Optional<T> coalesce(Supplier<? extends T>... suppliers)
      Lazily evaluates a set of suppliers, returning the first non-null result or Optional.empty() when no result.
      Returns:
      The first non-null result or Optional.empty() when all return null
    • coalesceE

      public static <T, Ex extends Throwable> Optional<T> coalesceE(SupplierE<? extends T,? extends Ex>... suppliers) throws Ex
      Lazily evaluates a set of suppliers, returning the first non-null result or Optional.empty() when no result.
      Returns:
      The first non-null result or Optional.empty() when all return null
      Throws:
      Ex