AbstractStringBuilder.charAt(int) does bounds check before calling charAt() (for non-latin Strings):
@Override
public char charAt(int index) {
checkIndex(index, count);
if (isLatin1()) {
return (char)(value[index] & 0xff);
}
return StringUTF16.charAt(value, index);
}
This can be improved by removing bounds check from ASB.charAt() in favour of one in String*.charAt()
@Override
public char charAt(int index) {
checkIndex(index, count);
if (isLatin1()) {
return (char)(value[index] & 0xff);
}
return StringUTF16.charAt(value, index);
}
This can be improved by removing bounds check from ASB.charAt() in favour of one in String*.charAt()
- relates to
-
JDK-8271732 Regression in StringBuilder.charAt bounds checking
-
- Closed
-