summaryrefslogtreecommitdiff
path: root/base/src/main/java/bjc/utils/data/Option.java
diff options
context:
space:
mode:
Diffstat (limited to 'base/src/main/java/bjc/utils/data/Option.java')
-rw-r--r--base/src/main/java/bjc/utils/data/Option.java24
1 files changed, 12 insertions, 12 deletions
diff --git a/base/src/main/java/bjc/utils/data/Option.java b/base/src/main/java/bjc/utils/data/Option.java
index 6eae21f..7869946 100644
--- a/base/src/main/java/bjc/utils/data/Option.java
+++ b/base/src/main/java/bjc/utils/data/Option.java
@@ -9,7 +9,7 @@ import java.util.function.UnaryOperator;
* @author ben
*
* @param <ContainedType>
- * The type of the value that may or may not be held.
+ * The type of the value that may or may not be held.
*/
public class Option<ContainedType> implements IHolder<ContainedType> {
private ContainedType held;
@@ -18,7 +18,7 @@ public class Option<ContainedType> implements IHolder<ContainedType> {
* Create a new optional, using the given initial value.
*
* @param seed
- * The initial value for the optional.
+ * The initial value for the optional.
*/
public Option(final ContainedType seed) {
held = seed;
@@ -26,7 +26,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);
}
@@ -40,14 +40,14 @@ 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));
}
@Override
public IHolder<ContainedType> transform(final UnaryOperator<ContainedType> transformer) {
- if (held != null) {
+ if(held != null) {
held = transformer.apply(held);
}
@@ -56,7 +56,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);
}
@@ -78,15 +78,15 @@ 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)) return false;
+ if(held == null) {
+ if(other.held != null) return false;
+ } else if(!held.equals(other.held)) return false;
return true;
}