summaryrefslogtreecommitdiff
path: root/BJC-Utils2/src/main/java/bjc/utils/data/Lazy.java
diff options
context:
space:
mode:
authorEVE <EVE@EVE-PC>2017-03-14 12:07:14 -0400
committerEVE <EVE@EVE-PC>2017-03-14 12:07:14 -0400
commit504ca816530efdff06bc202e0432ebd354aec304 (patch)
tree4836932fb81d1d625470502c78c94d202c9a7420 /BJC-Utils2/src/main/java/bjc/utils/data/Lazy.java
parent5c1163df17c46f7d3e15b6c7949c38843ec56146 (diff)
Cleanup
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/Lazy.java')
-rw-r--r--BJC-Utils2/src/main/java/bjc/utils/data/Lazy.java28
1 files changed, 12 insertions, 16 deletions
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 <ContainedType>
@@ -27,7 +27,7 @@ public class Lazy<ContainedType> implements IHolder<ContainedType> {
/**
* Create a new lazy value from the specified seed value
- *
+ *
* @param value
* The seed value to use
*/
@@ -39,7 +39,7 @@ public class Lazy<ContainedType> implements IHolder<ContainedType> {
/**
* 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<ContainedType> implements IHolder<ContainedType> {
actions.forEach(pendingActions::add);
Supplier<ContainedType> supplier = () -> {
- if (valueMaterialized) {
- return heldValue;
- }
+ if(valueMaterialized) return heldValue;
return valueSupplier.get();
};
@@ -90,7 +88,7 @@ public class Lazy<ContainedType> implements IHolder<ContainedType> {
return new Lazy<>(() -> {
ContainedType currVal = heldValue;
- if (!valueMaterialized) {
+ if(!valueMaterialized) {
currVal = valueSupplier.get();
}
@@ -101,10 +99,8 @@ public class Lazy<ContainedType> implements IHolder<ContainedType> {
@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<ContainedType> implements IHolder<ContainedType> {
@Override
public <UnwrappedType> UnwrappedType unwrap(Function<ContainedType, UnwrappedType> unwrapper) {
- if (!valueMaterialized) {
+ if(!valueMaterialized) {
heldValue = valueSupplier.get();
valueMaterialized = true;