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

karsten at torproject.org karsten at torproject.org
Mon Sep 10 15:29:13 UTC 2018


commit ec16e791150785cfda603961469bc86bd65218a7
Author: Karsten Loesing <karsten.loesing at gmx.net>
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);
 





More information about the tor-commits mailing list