From ba9cf27de7e9f31dfa97a7266979f300101d67f9 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 10 Nov 2016 19:44:22 -0500 Subject: Doc updates --- .../main/java/bjc/utils/data/BoundLazyPair.java | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (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 2b3fb29..c7eb965 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazyPair.java @@ -80,6 +80,10 @@ class BoundLazyPair @Override public IPair bindLeft( Function> leftBinder) { + if (leftBinder == null) { + throw new NullPointerException("Left binder must not be null"); + } + Supplier leftSupp = () -> { IPair newPair = boundPair; @@ -97,6 +101,11 @@ class BoundLazyPair @Override public IPair bindRight( Function> rightBinder) { + if (rightBinder == null) { + throw new NullPointerException( + "Right binder must not be null"); + } + Supplier rightSupp = () -> { IPair newPair = boundPair; @@ -116,6 +125,16 @@ class BoundLazyPair IPair otherPair, BiFunction leftCombiner, BiFunction rightCombiner) { + if (otherPair == null) { + throw new NullPointerException("Other pair must not be null"); + } else if (leftCombiner == null) { + throw new NullPointerException( + "Left combiner must not be null"); + } else if (rightCombiner == null) { + throw new NullPointerException( + "Right combiner must not be null"); + } + return otherPair.bind((otherLeft, otherRight) -> { return bind((leftVal, rightVal) -> { return new LazyPair<>( @@ -128,6 +147,10 @@ class BoundLazyPair @Override public IPair mapLeft( Function mapper) { + if (mapper == null) { + throw new NullPointerException("Mapper must not be null"); + } + Supplier leftSupp = () -> { if (!pairBound) { NewLeft leftVal = binder @@ -156,6 +179,10 @@ class BoundLazyPair @Override public IPair mapRight( Function mapper) { + if (mapper == null) { + throw new NullPointerException("Mapper must not be null"); + } + Supplier leftSupp = () -> { if (!pairBound) { return binder @@ -184,6 +211,10 @@ class BoundLazyPair @Override public MergedType merge( BiFunction merger) { + if (merger == null) { + throw new NullPointerException("Merger must not be null"); + } + if (!pairBound) { boundPair = binder.apply(leftSupplier.get(), rightSupplier.get()); -- cgit v1.2.3