diff options
| author | EVE <EVE@EVE-PC> | 2017-03-13 16:42:21 -0400 |
|---|---|---|
| committer | EVE <EVE@EVE-PC> | 2017-03-13 16:42:21 -0400 |
| commit | 27bf571d6413c3cc6a5d664b5bddd38d21d7b1cd (patch) | |
| tree | 847fb52acb091c1c613d37b8477094d5762c6988 /BJC-Utils2/src/main/java/bjc/utils/data/IHolder.java | |
| parent | aa807a96cae2c47259fb38f710640883060339e9 (diff) | |
Formatting
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/IHolder.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/data/IHolder.java | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/IHolder.java b/BJC-Utils2/src/main/java/bjc/utils/data/IHolder.java index a05d90e..7b6c8d5 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/IHolder.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/IHolder.java @@ -16,26 +16,25 @@ import bjc.utils.funcdata.theory.Functor; * @author ben * * @param <ContainedType> - * The type of value held + * The type of value held */ public interface IHolder<ContainedType> extends Functor<ContainedType> { /** * Bind a function across the value in this container * * @param <BoundType> - * The type of value in this container + * The type of value in this container * @param binder - * The function to bind to the value + * The function to bind to the value * @return A holder from binding the value */ - public <BoundType> IHolder<BoundType> bind( - Function<ContainedType, IHolder<BoundType>> binder); + public <BoundType> IHolder<BoundType> bind(Function<ContainedType, IHolder<BoundType>> binder); /** * Apply an action to the value * * @param action - * The action to apply to the value + * The action to apply to the value */ public default void doWith(Consumer<? super ContainedType> action) { transform((value) -> { @@ -46,10 +45,8 @@ public interface IHolder<ContainedType> extends Functor<ContainedType> { } @Override - default <ArgType, - ReturnType> Function<Functor<ArgType>, - Functor<ReturnType>> fmap( - Function<ArgType, ReturnType> func) { + default <ArgType, ReturnType> Function<Functor<ArgType>, Functor<ReturnType>> fmap( + Function<ArgType, ReturnType> func) { return (argumentFunctor) -> { if (!(argumentFunctor instanceof IHolder<?>)) { throw new IllegalArgumentException( @@ -71,13 +68,12 @@ public interface IHolder<ContainedType> extends Functor<ContainedType> { * Lifts a function to bind over this holder * * @param <NewType> - * The type of the functions return + * The type of the functions return * @param func - * The function to lift over the holder + * The function to lift over the holder * @return The function lifted over the holder */ - public <NewType> Function<ContainedType, IHolder<NewType>> lift( - Function<ContainedType, NewType> func); + public <NewType> Function<ContainedType, IHolder<NewType>> lift(Function<ContainedType, NewType> func); /** * Make this holder lazy @@ -113,19 +109,18 @@ public interface IHolder<ContainedType> extends Functor<ContainedType> { * Does not change the internal state of this holder * * @param <MappedType> - * The type of the mapped value + * The type of the mapped value * @param mapper - * The function to do mapping with + * The function to do mapping with * @return A holder with the mapped value */ - public <MappedType> IHolder<MappedType> map( - Function<ContainedType, MappedType> mapper); + public <MappedType> IHolder<MappedType> map(Function<ContainedType, MappedType> mapper); /** * Replace the held value with a new one * * @param newValue - * The value to hold instead + * The value to hold instead * @return The holder itself */ public default IHolder<ContainedType> replace(ContainedType newValue) { @@ -138,22 +133,20 @@ public interface IHolder<ContainedType> extends Functor<ContainedType> { * Transform the value held in this holder * * @param transformer - * The function to transform the value with + * The function to transform the value with * @return The holder itself, for easy chaining */ - public IHolder<ContainedType> transform( - UnaryOperator<ContainedType> transformer); + public IHolder<ContainedType> transform(UnaryOperator<ContainedType> transformer); /** * Unwrap the value contained in this holder so that it is no longer * held * * @param <UnwrappedType> - * The type of the unwrapped value + * The type of the unwrapped value * @param unwrapper - * The function to use to unwrap the value + * The function to use to unwrap the value * @return The unwrapped held value */ - public <UnwrappedType> UnwrappedType unwrap( - Function<ContainedType, UnwrappedType> unwrapper); + public <UnwrappedType> UnwrappedType unwrap(Function<ContainedType, UnwrappedType> unwrapper); } |
