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

[tor-commits] [exonerator/master] Replace Collections.sort with List.sort.



commit 40cac45b257d368dbdb1cdc9cc792f678357428a
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Aug 20 15:25:34 2018 +0200

    Replace Collections.sort with List.sort.
---
 .../torproject/metrics/exonerator/QueryServlet.java  | 20 +++++++++-----------
 1 file changed, 9 insertions(+), 11 deletions(-)

diff --git a/src/main/java/org/torproject/metrics/exonerator/QueryServlet.java b/src/main/java/org/torproject/metrics/exonerator/QueryServlet.java
index 77892f0..556d8d3 100644
--- a/src/main/java/org/torproject/metrics/exonerator/QueryServlet.java
+++ b/src/main/java/org/torproject/metrics/exonerator/QueryServlet.java
@@ -20,7 +20,6 @@ import java.time.ZoneOffset;
 import java.time.ZonedDateTime;
 import java.util.ArrayList;
 import java.util.Calendar;
-import java.util.Collections;
 import java.util.List;
 import java.util.SortedSet;
 import java.util.TimeZone;
@@ -356,16 +355,15 @@ public class QueryServlet extends HttpServlet {
         }
       }
       if (!matches.isEmpty()) {
-        Collections.sort(matches,
-            (m1, m2) -> {
-              if (m1 == m2) {
-                return 0;
-              } else if (!m1.timestamp.equals(m2.timestamp)) {
-                return m1.timestamp.compareTo(m2.timestamp);
-              } else {
-                return m1.fingerprint.compareTo(m2.fingerprint);
-              }
-            });
+        matches.sort((m1, m2) -> {
+          if (m1 == m2) {
+            return 0;
+          } else if (!m1.timestamp.equals(m2.timestamp)) {
+            return m1.timestamp.compareTo(m2.timestamp);
+          } else {
+            return m1.fingerprint.compareTo(m2.fingerprint);
+          }
+        });
         response.matches = matches.toArray(new QueryResponse.Match[0]);
       } else {
         List<String> nearbyAddresses = new ArrayList<>();



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