functional-reactive
Made in the European Union

Checked Functions

Functional interfaces that may throw checked exceptions.

Standard Function, BiFunction, Consumer and friends cannot throw checked exceptions without wrapping. functional-reactive ships drop-in replacements that can:

  • CheckedFunction<T, R>
  • CheckedBiFunction<T1, T2, R>
  • CheckedTriFunction<T1, T2, T3, R>
  • CheckedConsumer<T>, CheckedSupplier<T>, CheckedPredicate<T>, CheckedExecutor
CheckedFunction<String, Integer> parse = Integer::parseInt;
Result<Integer> r = parse.apply("42");   // Success(42)
Result<Integer> r2 = parse.apply("oops"); // Failure("...")

Every checked function returns a Result, so failures travel through your pipeline without explicit try/catch.