From 63d88eb8db1f7a6d5924ec2a8b7f462373d5ac9a Mon Sep 17 00:00:00 2001 From: bjculkin Date: Fri, 7 Apr 2017 10:51:31 -0400 Subject: Cleanup --- .../src/main/java/bjc/utils/data/Identity.java | 41 ++++++++++------------ 1 file changed, 18 insertions(+), 23 deletions(-) (limited to 'BJC-Utils2/src/main/java/bjc/utils/data/Identity.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/data/Identity.java b/BJC-Utils2/src/main/java/bjc/utils/data/Identity.java index 72fe68c..77e13cf 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/data/Identity.java +++ b/BJC-Utils2/src/main/java/bjc/utils/data/Identity.java @@ -41,41 +41,36 @@ public class Identity implements IHolder { return binder.apply(heldValue); } - /* - * (non-Javadoc) - * - * @see java.lang.Object#equals(java.lang.Object) - */ + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + + result = prime * result + ((heldValue == null) ? 0 : heldValue.hashCode()); + + return result; + } + @Override public boolean equals(Object obj) { if (this == obj) return true; - else if (obj == null) + if (obj == null) + return false; + if (!(obj instanceof Identity)) return false; - else if (getClass() != obj.getClass()) return false; Identity other = (Identity) obj; if (heldValue == null) { - if (other.heldValue != null) return false; - } else if (!heldValue.equals(other.heldValue)) return false; + if (other.heldValue != null) + return false; + } else if (!heldValue.equals(other.heldValue)) + return false; return true; } - @Override - public int hashCode() { - final int prime = 31; - - int result = 1; - - int fieldHash = heldValue == null ? 0 : heldValue.hashCode(); - - result = prime * result + fieldHash; - - return result; - } - @Override public Function> lift(Function func) { return (val) -> { @@ -90,7 +85,7 @@ public class Identity implements IHolder { @Override public String toString() { - return "holding[v=" + heldValue + "]"; + return String.format("Identity [heldValue=%s]", heldValue); } @Override -- cgit v1.2.3