From 504ca816530efdff06bc202e0432ebd354aec304 Mon Sep 17 00:00:00 2001 From: EVE Date: Tue, 14 Mar 2017 12:07:14 -0400 Subject: Cleanup --- .../java/bjc/utils/data/internals/BoundLazy.java | 38 ++++++++-------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/internals/BoundLazy.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/internals/BoundLazy.java b/BJC-Utils2/src/main/java/bjc/utils/data/internals/BoundLazy.java index 57bf006..0ec69f0 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/internals/BoundLazy.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/internals/BoundLazy.java @@ -1,14 +1,14 @@ package bjc.utils.data.internals; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.function.UnaryOperator; - import bjc.utils.data.IHolder; import bjc.utils.data.Lazy; import bjc.utils.funcdata.FunctionalList; import bjc.utils.funcdata.IList; +import java.util.function.Function; +import java.util.function.Supplier; +import java.util.function.UnaryOperator; + /** * Implements a lazy holder that has been bound */ @@ -48,9 +48,7 @@ public class BoundLazy implements IHolder IHolder bind(Function> bindr) { - if (bindr == null) { - throw new NullPointerException("Binder must not be null"); - } + if(bindr == null) throw new NullPointerException("Binder must not be null"); /* * Prepare a list of pending actions @@ -67,7 +65,7 @@ public class BoundLazy implements IHolder implements IHolder Function> lift( Function func) { - if (func == null) { - throw new NullPointerException("Function to lift must not be null"); - } + if(func == null) throw new NullPointerException("Function to lift must not be null"); return (val) -> { return new Lazy<>(func.apply(val)); @@ -96,9 +92,7 @@ public class BoundLazy implements IHolder IHolder map(Function mapper) { - if (mapper == null) { - throw new NullPointerException("Mapper must not be null"); - } + if(mapper == null) throw new NullPointerException("Mapper must not be null"); // Prepare a list of pending actions IList> pendingActions = new FunctionalList<>(); @@ -109,7 +103,7 @@ public class BoundLazy implements IHolder oldHolder = boundHolder; // Bound the value if it hasn't been bound - if (!holderBound) { + if(!holderBound) { oldHolder = oldSupplier.get().unwrap(binder); } @@ -123,18 +117,14 @@ public class BoundLazy implements IHolder transform(UnaryOperator transformer) { - if (transformer == null) { - throw new NullPointerException("Transformer must not be null"); - } + if(transformer == null) throw new NullPointerException("Transformer must not be null"); actions.add(transformer); @@ -143,11 +133,9 @@ public class BoundLazy implements IHolder UnwrappedType unwrap(Function unwrapper) { - if (unwrapper == null) { - throw new NullPointerException("Unwrapper must not be null"); - } + if(unwrapper == null) throw new NullPointerException("Unwrapper must not be null"); - if (!holderBound) { + if(!holderBound) { boundHolder = oldSupplier.get().unwrap(binder::apply); } -- cgit v1.2.3