diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-11 21:54:44 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-04-11 21:54:44 -0400 |
| commit | c8a00b789671d59589bcb5520c1e9d208bcc27f6 (patch) | |
| tree | 6b64e3c78f56d025c78ab08a9edc038af0b6e821 /BJC-Utils2/src/main/java/bjc/utils/data/experimental/IHolder.java | |
| parent | a716a7a53f85a6901128896da508d31c172011b4 (diff) | |
Work on restructing data.
Diffstat (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/experimental/IHolder.java')
| -rw-r--r-- | BJC-Utils2/src/main/java/bjc/utils/data/experimental/IHolder.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/experimental/IHolder.java b/BJC-Utils2/src/main/java/bjc/utils/data/experimental/IHolder.java index 2767897..7d1d7a0 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/experimental/IHolder.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/experimental/IHolder.java @@ -15,8 +15,11 @@ import java.util.function.UnaryOperator; public interface IHolder<ContainedType> { /** * Bind a function across the value in this container - * @param <BoundType> The type of value in this container - * @param binder The function to bind to the value + * + * @param <BoundType> + * The type of value in this container + * @param binder + * The function to bind to the value * @return A holder from binding the value */ public <BoundType> IHolder<BoundType> bind( @@ -82,4 +85,15 @@ public interface IHolder<ContainedType> { */ public <UnwrappedType> UnwrappedType unwrap( Function<ContainedType, UnwrappedType> unwrapper); + + /** + * Replace the held value with a new one + * + * @param newValue + * The value to hold instead + * @return The holder itself + */ + public default IHolder<ContainedType> replace(ContainedType newValue) { + return transform((oldValue) -> newValue); + } } |
