From dca8e9f586fd595a7995f07788318fb92b8cce79 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Thu, 28 Jul 2016 16:44:36 -0400 Subject: Format/Cleanup pass --- .../src/main/java/bjc/utils/data/BoundLazy.java | 49 ++++++++++------------ 1 file changed, 23 insertions(+), 26 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/BoundLazy.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazy.java b/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazy.java index 1256e31..b6cd715 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazy.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/BoundLazy.java @@ -15,28 +15,27 @@ class BoundLazy /* * The old value */ - private Supplier> oldSupplier; + private Supplier> oldSupplier; /* * The function to use to transform the old value into a new value */ - private Function> binder; + private Function> binder; /* * The bound value being held */ - private IHolder boundHolder; + private IHolder boundHolder; /* * Whether the bound value has been actualized or not */ - private boolean holderBound; + private boolean holderBound; /* * Transformations currently pending on the bound value */ - private IList> actions = - new FunctionalList<>(); + private IList> actions = new FunctionalList<>(); /* * Create a new bound lazy value @@ -48,13 +47,12 @@ class BoundLazy } @Override - public IHolder - bind(Function> bindr) { + public IHolder bind( + Function> bindr) { /* * Prepare a list of pending actions */ - IList> pendingActions = - new FunctionalList<>(); + IList> pendingActions = new FunctionalList<>(); actions.forEach(pendingActions::add); /* @@ -82,11 +80,18 @@ class BoundLazy } @Override - public IHolder - map(Function mapper) { + public Function> lift( + Function func) { + return (val) -> { + return new Lazy<>(func.apply(val)); + }; + } + + @Override + public IHolder map( + Function mapper) { // Prepare a list of pending actions - IList> pendingActions = - new FunctionalList<>(); + IList> pendingActions = new FunctionalList<>(); actions.forEach(pendingActions::add); // Prepare the new supplier @@ -117,28 +122,20 @@ class BoundLazy } @Override - public IHolder - transform(UnaryOperator transformer) { + public IHolder transform( + UnaryOperator transformer) { actions.add(transformer); return this; } @Override - public UnwrappedType - unwrap(Function unwrapper) { + public UnwrappedType unwrap( + Function unwrapper) { if (!holderBound) { boundHolder = oldSupplier.get().unwrap(binder::apply); } return boundHolder.unwrap(unwrapper); } - - @Override - public Function> - lift(Function func) { - return (val) -> { - return new Lazy<>(func.apply(val)); - }; - } } \ No newline at end of file -- cgit v1.2.3