From df972ae7dbdf051268c5cf7754e07c504524b197 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 28 Jul 2016 11:00:25 -0400 Subject: Note something to see if needs to be fixed later --- .../src/main/java/bjc/utils/data/LazyPair.java | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java b/BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java index d688e5b..e0b39cc 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/LazyPair.java @@ -13,6 +13,9 @@ import java.util.function.Supplier; * The type on the left side of the pair * @param * The type on the right side of the pair + * + * @TODO ensure we don't have any issues with values being materialized + * more than once */ public class LazyPair implements IPair { @@ -115,8 +118,8 @@ public class LazyPair } @Override - public MergedType - merge(BiFunction merger) { + public MergedType merge( + BiFunction merger) { if (!leftMaterialized) { leftValue = leftSupplier.get(); @@ -156,8 +159,8 @@ public class LazyPair } @Override - public IPair - mapLeft(Function mapper) { + public IPair mapLeft( + Function mapper) { Supplier leftSupp = () -> { if (leftMaterialized) { return mapper.apply(leftValue); @@ -178,8 +181,8 @@ public class LazyPair } @Override - public IPair - mapRight(Function mapper) { + public IPair mapRight( + Function mapper) { Supplier leftSupp = () -> { if (leftMaterialized) { return leftValue; @@ -200,11 +203,10 @@ public class LazyPair } @Override - public - IPair - combine(IPair otherPair, - BiFunction leftCombiner, - BiFunction rightCombiner) { + public IPair combine( + IPair otherPair, + BiFunction leftCombiner, + BiFunction rightCombiner) { return otherPair.bind((otherLeft, otherRight) -> { return bind((leftVal, rightVal) -> { return new LazyPair<>( -- cgit v1.2.3