diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-02-09 11:50:31 -0500 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2017-02-09 11:50:31 -0500 |
| commit | d2af58b0f68ebfbba2be7e7679efec6c8c0af12f (patch) | |
| tree | 2b16fbf014db350126e8c1b5f081312276f85f62 /BJC-Utils2/src/main/java/bjc/utils/data/Option.java | |
| parent | 187e1815488e3c1ed22e7592f304e632cffefb82 (diff) | |
Update
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/Option.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/data/Option.java | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/Option.java b/BJC-Utils2/src/main/java/bjc/utils/data/Option.java index 16d90e3..33b6327 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/Option.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/Option.java @@ -17,16 +17,15 @@ public class Option<ContainedType> implements IHolder<ContainedType> { /** * Create a new optional, using the given initial value * - * @param seedValue + * @param seed * The initial value for the optional */ - public Option(ContainedType seedValue) { - held = seedValue; + public Option(ContainedType seed) { + held = seed; } @Override - public <BoundType> IHolder<BoundType> bind( - Function<ContainedType, IHolder<BoundType>> binder) { + public <BoundType> IHolder<BoundType> bind(Function<ContainedType, IHolder<BoundType>> binder) { if (held == null) { return new Option<>(null); } @@ -35,16 +34,14 @@ public class Option<ContainedType> implements IHolder<ContainedType> { } @Override - public <NewType> Function<ContainedType, IHolder<NewType>> lift( - Function<ContainedType, NewType> func) { + public <NewType> Function<ContainedType, IHolder<NewType>> lift(Function<ContainedType, NewType> func) { return (val) -> { return new Option<>(func.apply(val)); }; } @Override - public <MappedType> IHolder<MappedType> map( - Function<ContainedType, MappedType> mapper) { + public <MappedType> IHolder<MappedType> map(Function<ContainedType, MappedType> mapper) { if (held == null) { return new Option<>(null); } @@ -53,8 +50,7 @@ public class Option<ContainedType> implements IHolder<ContainedType> { } @Override - public IHolder<ContainedType> transform( - UnaryOperator<ContainedType> transformer) { + public IHolder<ContainedType> transform(UnaryOperator<ContainedType> transformer) { if (held != null) { held = transformer.apply(held); } @@ -63,8 +59,7 @@ public class Option<ContainedType> implements IHolder<ContainedType> { } @Override - public <UnwrappedType> UnwrappedType unwrap( - Function<ContainedType, UnwrappedType> unwrapper) { + public <UnwrappedType> UnwrappedType unwrap(Function<ContainedType, UnwrappedType> unwrapper) { if (held == null) { return null; } |
