8294397: Replace StringBuffer with StringBuilder within java.text

Reviewed-by: lancea, naoto, bchristi
This commit is contained in:
Justin Lu 2022-10-05 18:42:00 +00:00 committed by Naoto Sato
parent f2c57186a4
commit 87acfee3c3
7 changed files with 55 additions and 80 deletions

View file

@ -101,18 +101,18 @@ final class MergeCollation {
PatternEntry last = findLastWithNoExtension(i-1);
for (int j = extList.size() - 1; j >= 0 ; j--) {
tmp = extList.get(j);
tmp.addToBuffer(result, false, withWhiteSpace, last);
tmp.addToBuilder(result, false, withWhiteSpace, last);
}
extList = null;
}
entry.addToBuffer(result, false, withWhiteSpace, null);
entry.addToBuilder(result, false, withWhiteSpace, null);
}
}
if (extList != null) {
PatternEntry last = findLastWithNoExtension(i-1);
for (int j = extList.size() - 1; j >= 0 ; j--) {
tmp = extList.get(j);
tmp.addToBuffer(result, false, withWhiteSpace, last);
tmp.addToBuilder(result, false, withWhiteSpace, last);
}
extList = null;
}
@ -151,7 +151,7 @@ final class MergeCollation {
{
PatternEntry entry = patterns.get(i);
if (entry != null) {
entry.addToBuffer(result, true, withWhiteSpace, null);
entry.addToBuilder(result, true, withWhiteSpace, null);
}
}
return result.toString();
@ -211,7 +211,7 @@ final class MergeCollation {
// This is really used as a local variable inside fixEntry, but we cache
// it here to avoid newing it up every time the method is called.
private transient StringBuffer excess = new StringBuffer();
private transient StringBuilder excess = new StringBuilder();
//
// When building a MergeCollation, we need to do lots of searches to see
@ -300,7 +300,7 @@ final class MergeCollation {
}
private final int findLastEntry(PatternEntry entry,
StringBuffer excessChars) throws ParseException
StringBuilder excessChars) throws ParseException
{
if (entry == null)
return 0;