--- a/jdk/src/share/classes/java/lang/AbstractStringBuilder.java Thu Nov 29 14:07:47 2012 -0800
+++ b/jdk/src/share/classes/java/lang/AbstractStringBuilder.java Thu Nov 29 14:09:45 2012 -0800
@@ -177,11 +177,10 @@
ensureCapacityInternal(newLength);
if (count < newLength) {
- for (; count < newLength; count++)
- value[count] = '\0';
- } else {
- count = newLength;
+ Arrays.fill(value, count, newLength, '\0');
}
+
+ count = newLength;
}
/**
@@ -1308,8 +1307,7 @@
* {@code null}.
*/
public int indexOf(String str, int fromIndex) {
- return String.indexOf(value, 0, count,
- str.toCharArray(), 0, str.length(), fromIndex);
+ return String.indexOf(value, 0, count, str, fromIndex);
}
/**
@@ -1352,8 +1350,7 @@
* {@code null}.
*/
public int lastIndexOf(String str, int fromIndex) {
- return String.lastIndexOf(value, 0, count,
- str.toCharArray(), 0, str.length(), fromIndex);
+ return String.lastIndexOf(value, 0, count, str, fromIndex);
}
/**