From fff6dc5d43539af05ae2679640240b8545b36947 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Tue, 10 May 2016 21:58:08 -0400 Subject: Added interface to JDK collector API --- .../main/java/bjc/utils/data/BoundLazyPair.java | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java b/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java index 1635e06..dcf9cca 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java @@ -26,8 +26,8 @@ class BoundLazyPair @Override public IPair bind( BiFunction> bindr) { - IHolder> newPair = new Identity<>( - boundPair); + IHolder> newPair = + new Identity<>(boundPair); IHolder newPairMade = new Identity<>(pairBound); Supplier leftSupp = () -> { @@ -93,8 +93,8 @@ class BoundLazyPair public MergedType merge(BiFunction merger) { if (!pairBound) { - boundPair = binder.apply(leftSupplier.get(), - rightSupplier.get()); + boundPair = + binder.apply(leftSupplier.get(), rightSupplier.get()); pairBound = true; } @@ -166,4 +166,19 @@ class BoundLazyPair return new LazyPair<>(leftSupp, rightSupp); } + + @Override + public + IPair + combine(IPair otherPair, + BiFunction leftCombiner, + BiFunction rightCombiner) { + return otherPair.bind((otherLeft, otherRight) -> { + return bind((leftVal, rightVal) -> { + return new LazyPair<>( + leftCombiner.apply(leftVal, otherLeft), + rightCombiner.apply(rightVal, otherRight)); + }); + }); + } } \ No newline at end of file -- cgit v1.2.3