From f51f6da7319787348c38b875652b5c0e9f88c8aa Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 13 Apr 2020 18:43:13 -0400 Subject: Cleanup pass Pass to do some cleanups --- src/main/java/bjc/data/internals/WrappedLazy.java | 38 +++++++++++++---------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'src/main/java/bjc/data/internals/WrappedLazy.java') diff --git a/src/main/java/bjc/data/internals/WrappedLazy.java b/src/main/java/bjc/data/internals/WrappedLazy.java index 17d2309..cda86fd 100644 --- a/src/main/java/bjc/data/internals/WrappedLazy.java +++ b/src/main/java/bjc/data/internals/WrappedLazy.java @@ -11,7 +11,7 @@ import bjc.data.Lazy; * * @author Ben Culkin * @param - * The type of the wrapped value. + * The type of the wrapped value. */ public class WrappedLazy implements IHolder { /* Held value. */ @@ -21,19 +21,18 @@ public class WrappedLazy implements IHolder { * Create a new wrapped lazy value. * * @param wrappedHolder - * The holder to make lazy. + * The holder to make lazy. */ public WrappedLazy(final IHolder wrappedHolder) { held = new Lazy<>(wrappedHolder); } /* - * This has an extra parameter, because otherwise it erases to the same - * as the public one. + * This has an extra parameter, because otherwise it erases to the same as the + * public one. * - * This is a case where reified generics would be useful, because then - * the compiler could know which one we meant without the dummy - * parameter. + * This is a case where reified generics would be useful, because then the + * compiler could know which one we meant without the dummy parameter. */ private WrappedLazy(final IHolder> wrappedHolder, @SuppressWarnings("unused") final boolean dummy) { @@ -41,8 +40,9 @@ public class WrappedLazy implements IHolder { } @Override - public IHolder bind(final Function> binder) { - final IHolder> newHolder = held.map((containedHolder) -> { + public IHolder + bind(final Function> binder) { + final IHolder> newHolder = held.map(containedHolder -> { return containedHolder.bind(binder); }); @@ -50,15 +50,17 @@ public class WrappedLazy implements IHolder { } @Override - public Function> lift(final Function func) { - return (val) -> { + public Function> + lift(final Function func) { + return val -> { return new Lazy<>(func.apply(val)); }; } @Override - public IHolder map(final Function mapper) { - final IHolder> newHolder = held.map((containedHolder) -> { + public IHolder + map(final Function mapper) { + final IHolder> newHolder = held.map(containedHolder -> { return containedHolder.map(mapper); }); @@ -66,8 +68,9 @@ public class WrappedLazy implements IHolder { } @Override - public IHolder transform(final UnaryOperator transformer) { - held.transform((containedHolder) -> { + public IHolder + transform(final UnaryOperator transformer) { + held.transform(containedHolder -> { return containedHolder.transform(transformer); }); @@ -75,8 +78,9 @@ public class WrappedLazy implements IHolder { } @Override - public UnwrappedType unwrap(final Function unwrapper) { - return held.unwrap((containedHolder) -> { + public UnwrappedType + unwrap(final Function unwrapper) { + return held.unwrap(containedHolder -> { return containedHolder.unwrap(unwrapper); }); } -- cgit v1.2.3