summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/data/HalfBoundLazyPair.java
diff options
context:
space:
mode:
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/HalfBoundLazyPair.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/HalfBoundLazyPair.java21
1 files changed, 10 insertions, 11 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/HalfBoundLazyPair.java b/BJC-Utils2/src/main/java/bjc/utils/data/HalfBoundLazyPair.java
index 72c0bdf..58c375b 100644
--- a/BJC-Utils2/src/main/java/bjc/utils/data/HalfBoundLazyPair.java
+++ b/BJC-Utils2/src/main/java/bjc/utils/data/HalfBoundLazyPair.java
@@ -4,6 +4,9 @@ import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Supplier;
+/*
+ * A lazy pair, with only one side bound
+ */
class HalfBoundLazyPair<OldType, NewLeft, NewRight>
implements IPair<NewLeft, NewRight> {
private Supplier<OldType> oldSupplier;
@@ -21,10 +24,9 @@ class HalfBoundLazyPair<OldType, NewLeft, NewRight>
@Override
public <BoundLeft, BoundRight> IPair<BoundLeft, BoundRight> bind(
- BiFunction<NewLeft, NewRight,
- IPair<BoundLeft, BoundRight>> bindr) {
- IHolder<IPair<NewLeft,
- NewRight>> newPair = new Identity<>(boundPair);
+ BiFunction<NewLeft, NewRight, IPair<BoundLeft, BoundRight>> bindr) {
+ IHolder<IPair<NewLeft, NewRight>> newPair = new Identity<>(
+ boundPair);
IHolder<Boolean> newPairMade = new Identity<>(pairBound);
Supplier<NewLeft> leftSupp = () -> {
@@ -81,13 +83,10 @@ class HalfBoundLazyPair<OldType, NewLeft, NewRight>
}
@Override
- public <OtherLeft, OtherRight, CombinedLeft,
- CombinedRight> IPair<CombinedLeft, CombinedRight> combine(
- IPair<OtherLeft, OtherRight> otherPair,
- BiFunction<NewLeft, OtherLeft,
- CombinedLeft> leftCombiner,
- BiFunction<NewRight, OtherRight,
- CombinedRight> rightCombiner) {
+ public <OtherLeft, OtherRight, CombinedLeft, CombinedRight> IPair<CombinedLeft, CombinedRight> combine(
+ IPair<OtherLeft, OtherRight> otherPair,
+ BiFunction<NewLeft, OtherLeft, CombinedLeft> leftCombiner,
+ BiFunction<NewRight, OtherRight, CombinedRight> rightCombiner) {
return otherPair.bind((otherLeft, otherRight) -> {
return bind((leftVal, rightVal) -> {
return new LazyPair<>(