From f9283a20abd9eaed0b0436bc54c60576233121f4 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 11 Apr 2016 09:32:59 -0400 Subject: Added new method to pairs and holders --- BJC-Utils2/src/main/java/bjc/utils/data/IPair.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/IPair.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java b/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java index e2ee6a4..a20ff36 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java @@ -14,7 +14,7 @@ import java.util.function.Function; * @param * The type stored in the right side of the pair */ -public interface IPair { +public interface IPair { /** * Create a new pair by applying the given functions to the left/right. @@ -34,6 +34,22 @@ public interface IPair { public IPair apply(Function leftTransformer, Function rightTransformer); + /** + * Apply a function to the two internal values that returns a new pair. + * + * Is a monadic bind. + * + * @param + * The new left pair type + * @param + * The new right pair type + * @param binder + * The function to use as a bind + * @return The new pair + */ + public IPair + bind(BiFunction> binder); + /** * Execute an action with the values of this pair. Has no effect on the * internal contents -- cgit v1.2.3