[tor-commits] [onionoo/master] Use String.indexOf(char) because it's faster.

karsten at torproject.org karsten at torproject.org
Mon Apr 14 13:29:24 UTC 2014


commit dda3e54078182d9f2fa863e817bf55d8e4317947
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Thu Mar 20 10:56:08 2014 +0100

    Use String.indexOf(char) because it's faster.
    
    Found with SonarQube.
---
 src/org/torproject/onionoo/NodeStatus.java |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/org/torproject/onionoo/NodeStatus.java b/src/org/torproject/onionoo/NodeStatus.java
index 30e1ed4..afe2ed3 100644
--- a/src/org/torproject/onionoo/NodeStatus.java
+++ b/src/org/torproject/onionoo/NodeStatus.java
@@ -338,7 +338,7 @@ public class NodeStatus extends Document {
       System.exit(1);
     } else if (orAddressAndPort.length() > 0) {
       String orAddress = orAddressAndPort.substring(0,
-          orAddressAndPort.lastIndexOf(":"));
+          orAddressAndPort.lastIndexOf(':'));
       if (this.exitAddresses.contains(orAddress)) {
         this.exitAddresses.remove(orAddress);
       }





More information about the tor-commits mailing list