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

[tor-commits] [onionoo/release] Replace Comparator with lambda.



commit ec16e791150785cfda603961469bc86bd65218a7
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Aug 20 12:37:07 2018 +0200

    Replace Comparator with lambda.
---
 .../org/torproject/onionoo/docs/WeightsStatus.java     | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/src/main/java/org/torproject/onionoo/docs/WeightsStatus.java b/src/main/java/org/torproject/onionoo/docs/WeightsStatus.java
index c221fdd..adce2c8 100644
--- a/src/main/java/org/torproject/onionoo/docs/WeightsStatus.java
+++ b/src/main/java/org/torproject/onionoo/docs/WeightsStatus.java
@@ -27,16 +27,14 @@ public class WeightsStatus extends Document {
     this.isDirty = false;
   }
 
-  private Comparator<long[]> histComparator = new Comparator<long[]>() {
-      public int compare(long[] first, long[] second) {
-        int relation = Long.compare(first[0], second[0]);
-        if (0 != relation) {
-          return relation;
-        } else {
-          return Long.compare(first[1], second[1]);
-        }
-      }
-    };
+  private Comparator<long[]> histComparator = (first, second) -> {
+    int relation = Long.compare(first[0], second[0]);
+    if (0 != relation) {
+      return relation;
+    } else {
+      return Long.compare(first[1], second[1]);
+    }
+  };
 
   private SortedMap<long[], double[]> history = new TreeMap<>(histComparator);
 



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