Class Functions

java.lang.Object
com.aoapps.lang.function.Functions

public final class Functions extends Object
Utilities for working with Function and FunctionE.
See Also:
  • Method Details

    • coalesce

      public static <T, R> Optional<R> coalesce(T t, Function<? super T,? extends R>... functions)
      Lazily evaluates a set of functions, 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, R, Ex extends Throwable> Optional<R> coalesceE(T t, FunctionE<? super T,? extends R,? extends Ex>... functions) throws Ex
      Lazily evaluates a set of functions, 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