From c8a00b789671d59589bcb5520c1e9d208bcc27f6 Mon Sep 17 00:00:00 2001 From: bculkin2442 Date: Mon, 11 Apr 2016 21:54:44 -0400 Subject: Work on restructing data. --- .../main/java/bjc/utils/data/experimental/IHolder.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/experimental/IHolder.java') 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 { /** * Bind a function across the value in this container - * @param The type of value in this container - * @param binder The function to bind to the value + * + * @param + * The type of value in this container + * @param binder + * The function to bind to the value * @return A holder from binding the value */ public IHolder bind( @@ -82,4 +85,15 @@ public interface IHolder { */ public UnwrappedType unwrap( Function unwrapper); + + /** + * Replace the held value with a new one + * + * @param newValue + * The value to hold instead + * @return The holder itself + */ + public default IHolder replace(ContainedType newValue) { + return transform((oldValue) -> newValue); + } } -- cgit v1.2.3