summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/data/IPair.java
diff options
context:
space:
mode:
authorbculkin2442 <bjculkin@mix.wvu.edu>2016-04-11 09:32:59 -0400
committerbculkin2442 <bjculkin@mix.wvu.edu>2016-04-11 09:32:59 -0400
commitf9283a20abd9eaed0b0436bc54c60576233121f4 (patch)
treecec1323fb3faf1a4dcee2394a114b821c2366166 /BJC-Utils2/src/main/java/bjc/utils/data/IPair.java
parent275a627719fc2231b16caea41130ff09f0f2b6a1 (diff)
Added new method to pairs and holders
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
*