From 889fac2bdf993dc86f64a8893c0260fdcf848acb Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 10 Apr 2017 16:40:33 -0400 Subject: Cleanup --- .../java/bjc/utils/data/internals/BoundLazy.java | 35 +++++++++++----------- 1 file changed, 18 insertions(+), 17 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 cc1c0c0..e5f1b95 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 */ @@ -17,12 +17,12 @@ public class BoundLazy implements IHolder> oldSupplier; + private final Supplier> oldSupplier; /* * The function to use to transform the old value into a new value */ - private Function> binder; + private final Function> binder; /* * The bound value being held @@ -37,30 +37,31 @@ public class BoundLazy implements IHolder> actions = new FunctionalList<>(); + private final IList> actions = new FunctionalList<>(); /* * Create a new bound lazy value */ - public BoundLazy(Supplier> supp, Function> binder) { + public BoundLazy(final Supplier> supp, + final Function> binder) { oldSupplier = supp; this.binder = binder; } @Override - public IHolder bind(Function> bindr) { + public IHolder bind(final Function> bindr) { if (bindr == null) throw new NullPointerException("Binder must not be null"); /* * Prepare a list of pending actions */ - IList> pendingActions = new FunctionalList<>(); + final IList> pendingActions = new FunctionalList<>(); actions.forEach(pendingActions::add); /* * Create the new supplier of a value */ - Supplier> typeSupplier = () -> { + final Supplier> typeSupplier = () -> { IHolder oldHolder = boundHolder; /* @@ -83,7 +84,7 @@ public class BoundLazy implements IHolder Function> lift( - Function func) { + final Function func) { if (func == null) throw new NullPointerException("Function to lift must not be null"); return (val) -> { @@ -92,15 +93,15 @@ public class BoundLazy implements IHolder IHolder map(Function mapper) { + public IHolder map(final Function mapper) { if (mapper == null) throw new NullPointerException("Mapper must not be null"); // Prepare a list of pending actions - IList> pendingActions = new FunctionalList<>(); + final IList> pendingActions = new FunctionalList<>(); actions.forEach(pendingActions::add); // Prepare the new supplier - Supplier typeSupplier = () -> { + final Supplier typeSupplier = () -> { IHolder oldHolder = boundHolder; // Bound the value if it hasn't been bound @@ -124,7 +125,7 @@ public class BoundLazy implements IHolder transform(UnaryOperator transformer) { + public IHolder transform(final UnaryOperator transformer) { if (transformer == null) throw new NullPointerException("Transformer must not be null"); actions.add(transformer); @@ -133,7 +134,7 @@ public class BoundLazy implements IHolder UnwrappedType unwrap(Function unwrapper) { + public UnwrappedType unwrap(final Function unwrapper) { if (unwrapper == null) throw new NullPointerException("Unwrapper must not be null"); if (!holderBound) { -- cgit v1.2.3