From 7f56645ba548b540d023cd3aa0ce6fc15703191a Mon Sep 17 00:00:00 2001 From: Marc Baloup Date: Wed, 12 Jun 2024 23:32:13 +0200 Subject: [PATCH] new FunctionException type --- .../lib/util/function/FunctionException.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pandalib-util/src/main/java/fr/pandacube/lib/util/function/FunctionException.java diff --git a/pandalib-util/src/main/java/fr/pandacube/lib/util/function/FunctionException.java b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/FunctionException.java new file mode 100644 index 0000000..aed9402 --- /dev/null +++ b/pandalib-util/src/main/java/fr/pandacube/lib/util/function/FunctionException.java @@ -0,0 +1,19 @@ +package fr.pandacube.lib.util.function; + +/** + * A function that can possibly throw a checked exception. + * @param the parameter for this function. + * @param the return value for this function. + * @param the exception type that this interface method can throw. + */ +@FunctionalInterface +public interface FunctionException { + /** + * Run on the specified parameters to return an int value. + * + * @param t the parameter of the function. + * @return the result of the function. + * @throws E if the function fails. + */ + R apply(T t) throws E; +}