summaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/bjc/data/IHolder.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/bjc/data/IHolder.java b/src/main/java/bjc/data/IHolder.java
index faa3f64..e0d39aa 100644
--- a/src/main/java/bjc/data/IHolder.java
+++ b/src/main/java/bjc/data/IHolder.java
@@ -161,4 +161,17 @@ public interface IHolder<ContainedType> extends Functor<ContainedType> {
*/
public <UnwrappedType> UnwrappedType
unwrap(Function<ContainedType, UnwrappedType> unwrapper);
+
+ /**
+ * Create an instace of IHolder containing a single value.
+ *
+ * @param <ElementType> The type of the value contained.
+ *
+ * @param contained The value to contain.
+ *
+ * @return An instance of IHolder containing that value.
+ */
+ static <ElementType> IHolder<ElementType> of(ElementType contained) {
+ return new Identity<>(contained);
+ }
}