From 338b2b16b6934d27dc4cd536fb5527b71985de4f Mon Sep 17 00:00:00 2001 From: bjculkin Date: Fri, 17 Mar 2017 19:46:55 -0400 Subject: Add more toString/hashCode/equals --- .../main/java/bjc/utils/esodata/PushdownMap.java | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'BJC-Utils2/src/main/java/bjc/utils/esodata/PushdownMap.java') diff --git a/BJC-Utils2/src/main/java/bjc/utils/esodata/PushdownMap.java b/BJC-Utils2/src/main/java/bjc/utils/esodata/PushdownMap.java index 4b758e3..7587b86 100644 --- a/BJC-Utils2/src/main/java/bjc/utils/esodata/PushdownMap.java +++ b/BJC-Utils2/src/main/java/bjc/utils/esodata/PushdownMap.java @@ -117,4 +117,40 @@ public class PushdownMap implements IMap public IList valueList() { return backing.valueList().map(stk -> stk.top()); } + + @Override + public int hashCode() { + final int prime = 31; + + int result = 1; + result = prime * result + ((backing == null) ? 0 : backing.hashCode()); + + return result; + } + + @Override + public boolean equals(Object obj) { + if(this == obj) return true; + if(obj == null) return false; + if(getClass() != obj.getClass()) return false; + + PushdownMap other = (PushdownMap) obj; + + if(backing == null) { + if(other.backing != null) return false; + } else if(!backing.equals(other.backing)) return false; + + return true; + } + + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + + builder.append("PushdownMap [backing="); + builder.append(backing); + builder.append("]"); + + return builder.toString(); + } } -- cgit v1.2.3