summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/data/lazy/LazyPair.java
diff options
context:
space:
mode:
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/lazy/LazyPair.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/lazy/LazyPair.java40
1 files changed, 35 insertions, 5 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/lazy/LazyPair.java b/BJC-Utils2/src/main/java/bjc/utils/data/lazy/LazyPair.java
index 2aab4ce..bd02b52 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/data/lazy/LazyPair.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/data/lazy/LazyPair.java
@@ -6,20 +6,41 @@ import java.util.function.Function;
import bjc.utils.data.IPair;
+/**
+ * A lazy holder of two values
+ *
+ * Lazy variant of {@link IPair}
+ *
+ * @author ben
+ *
+ * @param <L>
+ * The type of value stored on the left side of the pair
+ * @param <R>
+ * The type of value stored on the right side of the pair
+ */
public class LazyPair<L, R> implements IPair<L, R> {
+ /**
+ * The backing store for this pair
+ */
protected LazyHolder<IPair<L, R>> del;
+ /*
+ * (non-Javadoc)
+ *
+ * @see bjc.utils.data.IPair#apply(java.util.function.Function,
+ * java.util.function.Function)
+ */
@Override
public <L2, R2> IPair<L2, R2> apply(Function<L, L2> lf,
Function<R, R2> rf) {
return del.unwrap((par) -> par.apply(lf, rf));
}
- @Override
- public <E> E merge(BiFunction<L, R, E> bf) {
- return del.unwrap((par) -> par.merge(bf));
- }
-
+ /*
+ * (non-Javadoc)
+ *
+ * @see bjc.utils.data.IPair#doWith(java.util.function.BiConsumer)
+ */
@Override
public void doWith(BiConsumer<L, R> bc) {
del.doWith((par) -> {
@@ -27,4 +48,13 @@ public class LazyPair<L, R> implements IPair<L, R> {
});
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see bjc.utils.data.IPair#merge(java.util.function.BiFunction)
+ */
+ @Override
+ public <E> E merge(BiFunction<L, R, E> bf) {
+ return del.unwrap((par) -> par.merge(bf));
+ }
}