diff --git a/src/main/java/org/apache/commons/lang3/Functions.java b/src/main/java/org/apache/commons/lang3/Functions.java index 9bbffa7da..12749ea86 100644 --- a/src/main/java/org/apache/commons/lang3/Functions.java +++ b/src/main/java/org/apache/commons/lang3/Functions.java @@ -68,6 +68,13 @@ import org.apache.commons.lang3.Streams.FailableStream; */ public class Functions { + /** + * A functional interface like {@link BiConsumer} that declares a Throwable. + * + * @param Consumed type 1. + * @param Consumed type 2. + * @param Thrown exception. + */ @FunctionalInterface public interface FailableBiConsumer { @@ -81,8 +88,16 @@ public class Functions { void accept(O1 object1, O2 object2) throws T; } + /** + * A functional interface like {@link BiFunction} that declares a Throwable. + * + * @param Input type 1. + * @param Input type 2. + * @param Return type. + * @param Thrown exception. + */ @FunctionalInterface - public interface FailableBiFunction { + public interface FailableBiFunction { /** * Applies this function. @@ -92,25 +107,38 @@ public class Functions { * @return the result of the function * @throws T if the function fails */ - O apply(I1 input1, I2 input2) throws T; + R apply(I1 input1, I2 input2) throws T; } + /** + * A functional interface like {@link BiPredicate} that declares a Throwable. + * + * @param Predicate type 1. + * @param Predicate type 2. + * @param Thrown exception. + */ @FunctionalInterface - public interface FailableBiPredicate { + public interface FailableBiPredicate { /** - * Test the predicate. + * Tests the predicate. * * @param object1 the first object to test the predicate on * @param object2 the second object to test the predicate on * @return the predicate's evaluation * @throws T if the predicate fails */ - boolean test(O1 object1, O2 object2) throws T; + boolean test(I1 object1, I2 object2) throws T; } + /** + * A functional interface like {@link java.util.concurrent.Callable} that declares a Throwable. + * + * @param Return type. + * @param Thrown exception. + */ @FunctionalInterface - public interface FailableCallable { + public interface FailableCallable { /** * Calls the callable. @@ -118,9 +146,15 @@ public class Functions { * @return The value returned from the callable * @throws T if the callable fails */ - O call() throws T; + R call() throws T; } + /** + * A functional interface like {@link Consumer} that declares a Throwable. + * + * @param Consumed type 1. + * @param Thrown exception. + */ @FunctionalInterface public interface FailableConsumer { @@ -134,8 +168,15 @@ public class Functions { void accept(O object) throws T; } + /** + * A functional interface like {@link Function} that declares a Throwable. + * + * @param Input type 1. + * @param Return type. + * @param Thrown exception. + */ @FunctionalInterface - public interface FailableFunction { + public interface FailableFunction { /** * Applies this function. @@ -144,22 +185,33 @@ public class Functions { * @return the result of the function * @throws T if the function fails */ - O apply(I input) throws T; + R apply(I input) throws T; } + /** + * A functional interface like {@link Predicate} that declares a Throwable. + * + * @param Predicate type 1. + * @param Thrown exception. + */ @FunctionalInterface - public interface FailablePredicate { + public interface FailablePredicate { /** - * Test the predicate. + * Tests the predicate. * * @param object the object to test the predicate on * @return the predicate's evaluation * @throws T if the predicate fails */ - boolean test(O object) throws T; + boolean test(I object) throws T; } + /** + * A functional interface like {@link Runnable} that declares a Throwable. + * + * @param Thrown exception. + */ @FunctionalInterface public interface FailableRunnable { @@ -171,8 +223,14 @@ public class Functions { void run() throws T; } + /** + * A functional interface like {@link Supplier} that declares a Throwable. + * + * @param Return type. + * @param Thrown exception. + */ @FunctionalInterface - public interface FailableSupplier { + public interface FailableSupplier { /** * Supplies an object @@ -180,7 +238,7 @@ public class Functions { * @return the suppliers result * @throws T if the supplier fails */ - O get() throws T; + R get() throws T; } /**