summaryrefslogtreecommitdiff
path: root/src/main/java/bjc/data/internals/WrappedLazy.java
diff options
context:
space:
mode:
authorBen Culkin <scorpress@gmail.com>2020-04-13 18:43:13 -0400
committerBen Culkin <scorpress@gmail.com>2020-04-13 18:43:13 -0400
commitf51f6da7319787348c38b875652b5c0e9f88c8aa (patch)
tree943888fc724da2d2dedd89abec99dcbfcc089fd0 /src/main/java/bjc/data/internals/WrappedLazy.java
parent9052ed6da37af23ea82588d248f409e60a33c6cb (diff)
Cleanup pass
Pass to do some cleanups
Diffstat (limited to 'src/main/java/bjc/data/internals/WrappedLazy.java')
-rw-r--r--src/main/java/bjc/data/internals/WrappedLazy.java38
1 files changed, 21 insertions, 17 deletions
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 <ContainedType>
- * The type of the wrapped value.
+ * The type of the wrapped value.
*/
public class WrappedLazy<ContainedType> implements IHolder<ContainedType> {
/* Held value. */
@@ -21,19 +21,18 @@ public class WrappedLazy<ContainedType> implements IHolder<ContainedType> {
* Create a new wrapped lazy value.
*
* @param wrappedHolder
- * The holder to make lazy.
+ * The holder to make lazy.
*/
public WrappedLazy(final IHolder<ContainedType> 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<IHolder<ContainedType>> wrappedHolder,
@SuppressWarnings("unused") final boolean dummy) {
@@ -41,8 +40,9 @@ public class WrappedLazy<ContainedType> implements IHolder<ContainedType> {
}
@Override
- public <BoundType> IHolder<BoundType> bind(final Function<ContainedType, IHolder<BoundType>> binder) {
- final IHolder<IHolder<BoundType>> newHolder = held.map((containedHolder) -> {
+ public <BoundType> IHolder<BoundType>
+ bind(final Function<ContainedType, IHolder<BoundType>> binder) {
+ final IHolder<IHolder<BoundType>> newHolder = held.map(containedHolder -> {
return containedHolder.bind(binder);
});
@@ -50,15 +50,17 @@ public class WrappedLazy<ContainedType> implements IHolder<ContainedType> {
}
@Override
- public <NewType> Function<ContainedType, IHolder<NewType>> lift(final Function<ContainedType, NewType> func) {
- return (val) -> {
+ public <NewType> Function<ContainedType, IHolder<NewType>>
+ lift(final Function<ContainedType, NewType> func) {
+ return val -> {
return new Lazy<>(func.apply(val));
};
}
@Override
- public <MappedType> IHolder<MappedType> map(final Function<ContainedType, MappedType> mapper) {
- final IHolder<IHolder<MappedType>> newHolder = held.map((containedHolder) -> {
+ public <MappedType> IHolder<MappedType>
+ map(final Function<ContainedType, MappedType> mapper) {
+ final IHolder<IHolder<MappedType>> newHolder = held.map(containedHolder -> {
return containedHolder.map(mapper);
});
@@ -66,8 +68,9 @@ public class WrappedLazy<ContainedType> implements IHolder<ContainedType> {
}
@Override
- public IHolder<ContainedType> transform(final UnaryOperator<ContainedType> transformer) {
- held.transform((containedHolder) -> {
+ public IHolder<ContainedType>
+ transform(final UnaryOperator<ContainedType> transformer) {
+ held.transform(containedHolder -> {
return containedHolder.transform(transformer);
});
@@ -75,8 +78,9 @@ public class WrappedLazy<ContainedType> implements IHolder<ContainedType> {
}
@Override
- public <UnwrappedType> UnwrappedType unwrap(final Function<ContainedType, UnwrappedType> unwrapper) {
- return held.unwrap((containedHolder) -> {
+ public <UnwrappedType> UnwrappedType
+ unwrap(final Function<ContainedType, UnwrappedType> unwrapper) {
+ return held.unwrap(containedHolder -> {
return containedHolder.unwrap(unwrapper);
});
}