From 504ca816530efdff06bc202e0432ebd354aec304 Mon Sep 17 00:00:00 2001 From: EVE Date: Tue, 14 Mar 2017 12:07:14 -0400 Subject: Cleanup --- BJC-Utils2/src/main/java/bjc/utils/data/Lazy.java | 28 ++++++++++------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/Lazy.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/Lazy.java b/BJC-Utils2/src/main/java/bjc/utils/data/Lazy.java index 3a037d7..d4d350a 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/Lazy.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/Lazy.java @@ -1,17 +1,17 @@ package bjc.utils.data; -import java.util.function.Function; -import java.util.function.Supplier; -import java.util.function.UnaryOperator; - import bjc.utils.data.internals.BoundLazy; 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; + /** * A holder that holds a means to create a value, but doesn't actually compute * the value until it's needed - * + * * @author ben * * @param @@ -27,7 +27,7 @@ public class Lazy implements IHolder { /** * Create a new lazy value from the specified seed value - * + * * @param value * The seed value to use */ @@ -39,7 +39,7 @@ public class Lazy implements IHolder { /** * Create a new lazy value from the specified value source - * + * * @param supp * The source of a value to use */ @@ -62,9 +62,7 @@ public class Lazy implements IHolder { actions.forEach(pendingActions::add); Supplier supplier = () -> { - if (valueMaterialized) { - return heldValue; - } + if(valueMaterialized) return heldValue; return valueSupplier.get(); }; @@ -90,7 +88,7 @@ public class Lazy implements IHolder { return new Lazy<>(() -> { ContainedType currVal = heldValue; - if (!valueMaterialized) { + if(!valueMaterialized) { currVal = valueSupplier.get(); } @@ -101,10 +99,8 @@ public class Lazy implements IHolder { @Override public String toString() { - if (valueMaterialized) { - if (actions.isEmpty()) { - return "value[v='" + heldValue + "']"; - } + if(valueMaterialized) { + if(actions.isEmpty()) return "value[v='" + heldValue + "']"; return "value[v='" + heldValue + "'] (has pending transforms)"; } @@ -121,7 +117,7 @@ public class Lazy implements IHolder { @Override public UnwrappedType unwrap(Function unwrapper) { - if (!valueMaterialized) { + if(!valueMaterialized) { heldValue = valueSupplier.get(); valueMaterialized = true; -- cgit v1.2.3