[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [onionoo/release] Simplify compareTo methods.



commit f8ee7cf0ece963f35c311ed9e057271cdd5992bf
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Aug 20 15:22:37 2018 +0200

    Simplify compareTo methods.
---
 src/main/java/org/torproject/onionoo/docs/ClientsHistory.java | 3 +--
 src/main/java/org/torproject/onionoo/docs/UptimeHistory.java  | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/torproject/onionoo/docs/ClientsHistory.java b/src/main/java/org/torproject/onionoo/docs/ClientsHistory.java
index ba21458..15e70c5 100644
--- a/src/main/java/org/torproject/onionoo/docs/ClientsHistory.java
+++ b/src/main/java/org/torproject/onionoo/docs/ClientsHistory.java
@@ -194,8 +194,7 @@ public class ClientsHistory implements Comparable<ClientsHistory> {
 
   @Override
   public int compareTo(ClientsHistory other) {
-    return this.startMillis < other.startMillis ? -1
-        : this.startMillis > other.startMillis ? 1 : 0;
+    return Long.compare(this.startMillis, other.startMillis);
   }
 
   @Override
diff --git a/src/main/java/org/torproject/onionoo/docs/UptimeHistory.java b/src/main/java/org/torproject/onionoo/docs/UptimeHistory.java
index f8cc116..d549f92 100644
--- a/src/main/java/org/torproject/onionoo/docs/UptimeHistory.java
+++ b/src/main/java/org/torproject/onionoo/docs/UptimeHistory.java
@@ -128,8 +128,7 @@ public class UptimeHistory implements Comparable<UptimeHistory> {
     } else if (!this.relay && other.relay) {
       return 1;
     }
-    return this.startMillis < other.startMillis ? -1
-        : this.startMillis > other.startMillis ? 1 : 0;
+    return Long.compare(this.startMillis, other.startMillis);
   }
 
   @Override



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits