summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java
diff options
context:
space:
mode:
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/IPair.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/IPair.java18
1 files changed, 17 insertions, 1 deletions
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 <R>
* The type stored in the right side of the pair
*/
-public interface IPair<L, R> {
+public interface IPair<L, R> {
/**
* Create a new pair by applying the given functions to the left/right.
@@ -35,6 +35,22 @@ public interface IPair<L, R> {
Function<R, R2> rightTransformer);
/**
+ * Apply a function to the two internal values that returns a new pair.
+ *
+ * Is a monadic bind.
+ *
+ * @param <L2>
+ * The new left pair type
+ * @param <R2>
+ * The new right pair type
+ * @param binder
+ * The function to use as a bind
+ * @return The new pair
+ */
+ public <L2, R2> IPair<L2, R2>
+ bind(BiFunction<L, R, IPair<L2, R2>> binder);
+
+ /**
* Execute an action with the values of this pair. Has no effect on the
* internal contents
*