8272687: Replace StringBuffer with StringBuilder in RuleBasedCollator

Reviewed-by: lancea, naoto, bchristi, bpb
This commit is contained in:
Justin Lu 2022-09-26 22:31:51 +00:00 committed by Brent Christian
parent b88ee1ee22
commit 43eff2b309
2 changed files with 10 additions and 10 deletions

View File

@ -243,7 +243,7 @@ final class RBCollationTables {
*/
//shemran/Note: this is used for secondary order value reverse, no
// need to consider supplementary pair.
static void reverse (StringBuffer result, int from, int to)
static void reverse (StringBuilder result, int from, int to)
{
int i = from;
char swap;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -605,9 +605,9 @@ public class RuleBasedCollator extends Collator{
return null;
if (primResult == null) {
primResult = new StringBuffer();
secResult = new StringBuffer();
terResult = new StringBuffer();
primResult = new StringBuilder();
secResult = new StringBuilder();
terResult = new StringBuilder();
} else {
primResult.setLength(0);
secResult.setLength(0);
@ -681,8 +681,8 @@ public class RuleBasedCollator extends Collator{
}
primResult.append((char)0);
secResult.append((char)0);
secResult.append(terResult.toString());
primResult.append(secResult.toString());
secResult.append(terResult);
primResult.append(secResult);
if (getStrength() == IDENTICAL) {
primResult.append((char)0);
@ -762,9 +762,9 @@ public class RuleBasedCollator extends Collator{
// Internal objects that are cached across calls so that they don't have to
// be created/destroyed on every call to compare() and getCollationKey()
private StringBuffer primResult = null;
private StringBuffer secResult = null;
private StringBuffer terResult = null;
private StringBuilder primResult = null;
private StringBuilder secResult = null;
private StringBuilder terResult = null;
private CollationElementIterator sourceCursor = null;
private CollationElementIterator targetCursor = null;
}