harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r824010 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet4Address.java
Date Sun, 11 Oct 2009 03:49:03 GMT
Author: ndbeyer
Date: Sun Oct 11 03:49:02 2009
New Revision: 824010

URL: http://svn.apache.org/viewvc?rev=824010&view=rev
Log:
convert string concatenation in loop to use StringBuilder

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet4Address.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet4Address.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet4Address.java?rev=824010&r1=824009&r2=824010&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet4Address.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet4Address.java
Sun Oct 11 03:49:02 2009
@@ -218,14 +218,14 @@
      */
     @Override
     public String getHostAddress() {
-        String hostAddress = ""; //$NON-NLS-1$
+        final StringBuilder hostAddress = new StringBuilder();
         for (int i = 0; i < 4; i++) {
-            hostAddress += ipaddress[i] & 255;
+            hostAddress.append(ipaddress[i] & 255);
             if (i != 3) {
-                hostAddress += "."; //$NON-NLS-1$
+                hostAddress.append('.');
             }
         }
-        return hostAddress;
+        return hostAddress.toString();
     }
 
     /**



Mime
View raw message