From 0a828f500bb265ca2545c4fc15f58e0aa06c8500 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 14 Oct 2014 03:46:38 -0400 Subject: [PATCH] Implement equals and hashCode for ResolveSource Useful for debugging or whatever. --- .../com/typesafe/config/impl/ResolveSource.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/config/src/main/java/com/typesafe/config/impl/ResolveSource.java b/config/src/main/java/com/typesafe/config/impl/ResolveSource.java index 6eea30a3..dd6a4d74 100644 --- a/config/src/main/java/com/typesafe/config/impl/ResolveSource.java +++ b/config/src/main/java/com/typesafe/config/impl/ResolveSource.java @@ -275,6 +275,23 @@ final class ResolveSource { final T value; final Node next; + @Override + public int hashCode() { + return value.hashCode() + 41 * (41 + next.hashCode()); + } + + @Override + public boolean equals(Object other) { + if (other instanceof Node) { + if (value == ((Node) other).value) + return true; + else + return value.equals(((Node) other).value); + } else { + return false; + } + } + Node(T value, Node next) { this.value = value; this.next = next;