src/java.base/share/classes/java/lang/String.java
changeset 54550 5fa7fbddfe9d
parent 54486 7fd299216e97
child 54597 ab57d6bebed8
--- a/src/java.base/share/classes/java/lang/String.java	Tue Apr 16 21:29:33 2019 +0000
+++ b/src/java.base/share/classes/java/lang/String.java	Wed Apr 17 00:06:38 2019 +0200
@@ -1965,20 +1965,7 @@
         if (str.isEmpty()) {
             return this;
         }
-        if (coder() == str.coder()) {
-            byte[] val = this.value;
-            byte[] oval = str.value;
-            int len = val.length + oval.length;
-            byte[] buf = Arrays.copyOf(val, len);
-            System.arraycopy(oval, 0, buf, val.length, oval.length);
-            return new String(buf, coder);
-        }
-        int len = length();
-        int olen = str.length();
-        byte[] buf = StringUTF16.newBytesFor(len + olen);
-        getBytes(buf, 0, UTF16);
-        str.getBytes(buf, len, UTF16);
-        return new String(buf, UTF16);
+        return StringConcatHelper.simpleConcat(this, str);
     }
 
     /**