commit ca390d2ab17897a45a24c6ab1f2ff2a710253c32 Author: Karsten Loesing karsten.loesing@gmx.net Date: Thu Mar 20 10:47:37 2014 +0100
Implement hashCode() whenever implementing equals().
Found with SonarQube. --- src/org/torproject/onionoo/ClientsStatus.java | 4 ++++ src/org/torproject/onionoo/UptimeStatus.java | 4 ++++ 2 files changed, 8 insertions(+)
diff --git a/src/org/torproject/onionoo/ClientsStatus.java b/src/org/torproject/onionoo/ClientsStatus.java index e315fc3..c1ce80e 100644 --- a/src/org/torproject/onionoo/ClientsStatus.java +++ b/src/org/torproject/onionoo/ClientsStatus.java @@ -165,6 +165,10 @@ class ClientsHistory implements Comparable<ClientsHistory> { return other instanceof ClientsHistory && this.startMillis == ((ClientsHistory) other).startMillis; } + + public int hashCode() { + return (int) this.startMillis; + } }
class ClientsStatus extends Document { diff --git a/src/org/torproject/onionoo/UptimeStatus.java b/src/org/torproject/onionoo/UptimeStatus.java index fedf1a1..4d8dca7 100644 --- a/src/org/torproject/onionoo/UptimeStatus.java +++ b/src/org/torproject/onionoo/UptimeStatus.java @@ -89,6 +89,10 @@ class UptimeHistory this.relay == ((UptimeHistory) other).relay && this.startMillis == ((UptimeHistory) other).startMillis; } + + public int hashCode() { + return (int) this.startMillis + (this.relay ? 1 : 0); + } }
class UptimeStatus extends Document {
tor-commits@lists.torproject.org