From f51f6da7319787348c38b875652b5c0e9f88c8aa Mon Sep 17 00:00:00 2001 From: Ben Culkin Date: Mon, 13 Apr 2020 18:43:13 -0400 Subject: Cleanup pass Pass to do some cleanups --- src/main/java/bjc/data/Identity.java | 40 ++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'src/main/java/bjc/data/Identity.java') diff --git a/src/main/java/bjc/data/Identity.java b/src/main/java/bjc/data/Identity.java index 8645c4c..c80c7e1 100644 --- a/src/main/java/bjc/data/Identity.java +++ b/src/main/java/bjc/data/Identity.java @@ -9,7 +9,7 @@ import java.util.function.UnaryOperator; * @author ben * * @param - * The type contained in the holder. + * The type contained in the holder. */ public class Identity implements IHolder { /* The held value. */ @@ -24,14 +24,15 @@ public class Identity implements IHolder { * Create a holder holding the specified value. * * @param value - * The value to hold. + * The value to hold. */ public Identity(final ContainedType value) { heldValue = value; } @Override - public IHolder bind(final Function> binder) { + public IHolder + bind(final Function> binder) { return binder.apply(heldValue); } @@ -47,28 +48,35 @@ public class Identity implements IHolder { @Override public boolean equals(final Object obj) { - if(this == obj) return true; - if(obj == null) return false; - if(!(obj instanceof Identity)) return false; + if (this == obj) + return true; + if (obj == null) + return false; + if (!(obj instanceof Identity)) + return false; final Identity other = (Identity) obj; - if(heldValue == null) { - if(other.heldValue != null) return false; - } else if(!heldValue.equals(other.heldValue)) return false; + if (heldValue == null) { + if (other.heldValue != null) + return false; + } else if (!heldValue.equals(other.heldValue)) + return false; return true; } @Override - public Function> lift(final Function func) { - return (val) -> { + public Function> + lift(final Function func) { + return val -> { return new Identity<>(func.apply(val)); }; } @Override - public IHolder map(final Function mapper) { + public IHolder + map(final Function mapper) { return new Identity<>(mapper.apply(heldValue)); } @@ -78,14 +86,16 @@ public class Identity implements IHolder { } @Override - public IHolder transform(final UnaryOperator transformer) { + public IHolder + transform(final UnaryOperator transformer) { heldValue = transformer.apply(heldValue); return this; } @Override - public UnwrappedType unwrap(final Function unwrapper) { + public UnwrappedType + unwrap(final Function unwrapper) { return unwrapper.apply(heldValue); } @@ -93,7 +103,7 @@ public class Identity implements IHolder { * Create a new identity container. * * @param val - * The contained value. + * The contained value. * * @return A new identity container. */ -- cgit v1.2.3