This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch dev/JSPT-111
in repository java-support.
View the commit online:
http://git.shibboleth.net/view/?p=java-support.git;a=commit;h=d5d13a17f0c6a6467cde1c64eed4167e8f0471ea
commit d5d13a17f0c6a6467cde1c64eed4167e8f0471ea
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Jan 24 10:59:45 2022 -0500
Add Function to BiFunction adapters.
---
.../java/support/logic/BiFunctionSupport.java | 30 ++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/main/java/net/shibboleth/utilities/java/support/logic/BiFunctionSupport.java b/src/main/java/net/shibboleth/utilities/java/support/logic/BiFunctionSupport.java
index 33b7fa1..a5aecae 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/logic/BiFunctionSupport.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/logic/BiFunctionSupport.java
@@ -88,4 +88,34 @@ public final class BiFunctionSupport {
return predicate::test;
}
+ /**
+ * Adapts a {@link Function} into a {BiFunction} that ignores the second argument.
+ *
+ * @param <A> input type of function
+ * @param <B> ignored argument type
+ * @param <C> return type
+ * @param function the function to apply
+ *
+ * @return the adapted object
+ */
+ @Nonnull public static <A,B,C> BiFunction<A,B,C> forFunctionOfFirstArg(
+ @Nonnull @ParameterName(name="function") final Function<? super A,? extends C> function) {
+ return (a,b) -> function.apply(a);
+ }
+
+ /**
+ * Adapts a {@link Function} into a {BiFunction} that ignores the first argument.
+ *
+ * @param <A> ignored argument type
+ * @param <B> input type of function
+ * @param <C> return type
+ * @param function the function to apply
+ *
+ * @return the adapted object
+ */
+ @Nonnull public static <A,B,C> BiFunction<A,B,C> forFunctionOfSecondArg(
+ @Nonnull @ParameterName(name="function") final Function<? super B,? extends C> function) {
+ return (a,b) -> function.apply(b);
+ }
+
}
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.