You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by nd...@apache.org on 2009/10/11 05:49:03 UTC

svn commit: r824010 - /harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/net/Inet4Address.java

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();
     }
 
     /**