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

[tor-commits] [collector/release] Use parameterized constructor for bulk add.



commit 1e61e8228988b2494b98da58192e780d46bd2ea1
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Tue Aug 21 11:55:44 2018 +0200

    Use parameterized constructor for bulk add.
---
 .../torproject/metrics/collector/exitlists/ExitListDownloader.java  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/torproject/metrics/collector/exitlists/ExitListDownloader.java b/src/main/java/org/torproject/metrics/collector/exitlists/ExitListDownloader.java
index 5eab578..66fc1a7 100644
--- a/src/main/java/org/torproject/metrics/collector/exitlists/ExitListDownloader.java
+++ b/src/main/java/org/torproject/metrics/collector/exitlists/ExitListDownloader.java
@@ -168,10 +168,8 @@ public class ExitListDownloader extends CollecTorMain {
     while (!filesInInputDir.isEmpty()) {
       File pop = filesInInputDir.pop();
       if (pop.isDirectory()) {
-        SortedSet<File> lastThreeElements = new TreeSet<>();
-        for (File f : pop.listFiles()) {
-          lastThreeElements.add(f);
-        }
+        SortedSet<File> lastThreeElements
+            = new TreeSet<>(Arrays.asList(pop.listFiles()));
         while (lastThreeElements.size() > 3) {
           lastThreeElements.remove(lastThreeElements.first());
         }



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