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

[tor-commits] [exonerator/master] Use foreach loop.



commit 72acf8249323809040c98798020df54039c9a1c5
Author: Karsten Loesing <karsten.loesing@xxxxxxx>
Date:   Mon Aug 20 14:57:03 2018 +0200

    Use foreach loop.
---
 .../torproject/metrics/exonerator/ExoneraTorDatabaseImporter.java   | 3 +--
 .../java/org/torproject/metrics/exonerator/ExoneraTorServlet.java   | 3 +--
 src/main/java/org/torproject/metrics/exonerator/QueryServlet.java   | 6 ++----
 3 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorDatabaseImporter.java b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorDatabaseImporter.java
index 5e8da87..d27f8d8 100644
--- a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorDatabaseImporter.java
+++ b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorDatabaseImporter.java
@@ -282,8 +282,7 @@ public class ExoneraTorDatabaseImporter {
           int end = orAddress.length()
               - (orAddress.endsWith("::]") ? 2 : 1);
           String[] parts = orAddress.substring(start, end).split(":", -1);
-          for (int i = 0; i < parts.length; i++) {
-            String part = parts[i];
+          for (String part : parts) {
             if (part.length() == 0) {
               addressHex.append("x");
             } else if (part.length() <= 4) {
diff --git a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java
index 4c85480..4a99e19 100644
--- a/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java
+++ b/src/main/java/org/torproject/metrics/exonerator/ExoneraTorServlet.java
@@ -269,8 +269,7 @@ public class ExoneraTorServlet extends HttpServlet {
         int end = ipParameter.length()
             - (ipParameter.endsWith("::") ? 1 : 0);
         String[] parts = ipParameter.substring(start, end).split(":", -1);
-        for (int i = 0; i < parts.length; i++) {
-          String part = parts[i];
+        for (String part : parts) {
           if (part.length() == 0) {
             addressHex.append("x");
           } else if (part.length() <= 4) {
diff --git a/src/main/java/org/torproject/metrics/exonerator/QueryServlet.java b/src/main/java/org/torproject/metrics/exonerator/QueryServlet.java
index ef12f00..77892f0 100644
--- a/src/main/java/org/torproject/metrics/exonerator/QueryServlet.java
+++ b/src/main/java/org/torproject/metrics/exonerator/QueryServlet.java
@@ -143,8 +143,7 @@ public class QueryServlet extends HttpServlet {
         int end = ipParameter.length()
             - (ipParameter.endsWith("::") ? 1 : 0);
         String[] parts = ipParameter.substring(start, end).split(":", -1);
-        for (int i = 0; i < parts.length; i++) {
-          String part = parts[i];
+        for (String part : parts) {
           if (part.length() == 0) {
             addressHex.append("x");
           } else if (part.length() <= 4) {
@@ -189,8 +188,7 @@ public class QueryServlet extends HttpServlet {
     int start = relayIp.startsWith("::") ? 1 : 0;
     int end = relayIp.length() - (relayIp.endsWith("::") ? 1 : 0);
     String[] parts = relayIp.substring(start, end).split(":", -1);
-    for (int i = 0; i < parts.length; i++) {
-      String part = parts[i];
+    for (String part : parts) {
       if (part.length() == 0) {
         addressHex.append("x");
       } else if (part.length() <= 4) {



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