Implement equals and hashCode for ResolveSource

Useful for debugging or whatever.
This commit is contained in:
Havoc Pennington 2014-10-14 03:46:38 -04:00
parent c8f42ef92d
commit 0a828f500b

View File

@ -275,6 +275,23 @@ final class ResolveSource {
final T value;
final Node<T> 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<T> next) {
this.value = value;
this.next = next;