diff options
Diffstat (limited to 'src/main/java/bjc/data/Option.java')
| -rw-r--r-- | src/main/java/bjc/data/Option.java | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/src/main/java/bjc/data/Option.java b/src/main/java/bjc/data/Option.java index b5d6d5e..84e71a2 100644 --- a/src/main/java/bjc/data/Option.java +++ b/src/main/java/bjc/data/Option.java @@ -27,8 +27,7 @@ public class Option<ContainedType> implements IHolder<ContainedType> { @Override public <BoundType> IHolder<BoundType> bind(final Function<ContainedType, IHolder<BoundType>> binder) { - if (held == null) - return new Option<>(null); + if (held == null) return new Option<>(null); return binder.apply(held); } @@ -42,8 +41,7 @@ public class Option<ContainedType> implements IHolder<ContainedType> { @Override public <MappedType> IHolder<MappedType> map(final Function<ContainedType, MappedType> mapper) { - if (held == null) - return new Option<>(null); + if (held == null) return new Option<>(null); return new Option<>(mapper.apply(held)); } @@ -51,9 +49,7 @@ public class Option<ContainedType> implements IHolder<ContainedType> { @Override public IHolder<ContainedType> transform(final UnaryOperator<ContainedType> transformer) { - if (held != null) { - held = transformer.apply(held); - } + if (held != null) held = transformer.apply(held); return this; } @@ -61,8 +57,7 @@ public class Option<ContainedType> implements IHolder<ContainedType> { @Override public <UnwrappedType> UnwrappedType unwrap(final Function<ContainedType, UnwrappedType> unwrapper) { - if (held == null) - return null; + if (held == null) return null; return unwrapper.apply(held); } @@ -84,20 +79,17 @@ public class Option<ContainedType> implements IHolder<ContainedType> { @Override public boolean equals(final Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (!(obj instanceof Option<?>)) - return false; + if (this == obj) return true; + if (obj == null) return false; + if (!(obj instanceof Option<?>)) return false; final Option<?> other = (Option<?>) obj; if (held == null) { - if (other.held != null) - return false; - } else if (!held.equals(other.held)) + if (other.held != null) return false; + } else if (!held.equals(other.held)) { return false; + } return true; } |
