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

[tor-commits] [onionoo/release] Avoid manual array copies.



commit cc0ed7b085e68a8c196cd3596bb0997c11d7a4af
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Aug 20 15:41:51 2018 +0200

    Avoid manual array copies.
---
 src/main/java/org/torproject/onionoo/docs/UptimeHistory.java | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/torproject/onionoo/docs/UptimeHistory.java b/src/main/java/org/torproject/onionoo/docs/UptimeHistory.java
index d549f92..3c7f61e 100644
--- a/src/main/java/org/torproject/onionoo/docs/UptimeHistory.java
+++ b/src/main/java/org/torproject/onionoo/docs/UptimeHistory.java
@@ -6,6 +6,7 @@ package org.torproject.onionoo.docs;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.util.Arrays;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
@@ -88,9 +89,7 @@ public class UptimeHistory implements Comparable<UptimeHistory> {
     SortedSet<String> flags = null;
     if (parts[0].equals("R")) {
       flags = new TreeSet<>();
-      for (int i = 3; i < parts.length; i++) {
-        flags.add(parts[i]);
-      }
+      flags.addAll(Arrays.asList(parts).subList(3, parts.length));
     }
     return new UptimeHistory(relay, startMillis, uptimeHours, flags);
   }



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