mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 14:54:52 +02:00
8272687: Replace StringBuffer with StringBuilder in RuleBasedCollator
Reviewed-by: lancea, naoto, bchristi, bpb
This commit is contained in:
parent
b88ee1ee22
commit
43eff2b309
2 changed files with 10 additions and 10 deletions
|
@ -243,7 +243,7 @@ final class RBCollationTables {
|
||||||
*/
|
*/
|
||||||
//shemran/Note: this is used for secondary order value reverse, no
|
//shemran/Note: this is used for secondary order value reverse, no
|
||||||
// need to consider supplementary pair.
|
// 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;
|
int i = from;
|
||||||
char swap;
|
char swap;
|
||||||
|
|
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -605,9 +605,9 @@ public class RuleBasedCollator extends Collator{
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (primResult == null) {
|
if (primResult == null) {
|
||||||
primResult = new StringBuffer();
|
primResult = new StringBuilder();
|
||||||
secResult = new StringBuffer();
|
secResult = new StringBuilder();
|
||||||
terResult = new StringBuffer();
|
terResult = new StringBuilder();
|
||||||
} else {
|
} else {
|
||||||
primResult.setLength(0);
|
primResult.setLength(0);
|
||||||
secResult.setLength(0);
|
secResult.setLength(0);
|
||||||
|
@ -681,8 +681,8 @@ public class RuleBasedCollator extends Collator{
|
||||||
}
|
}
|
||||||
primResult.append((char)0);
|
primResult.append((char)0);
|
||||||
secResult.append((char)0);
|
secResult.append((char)0);
|
||||||
secResult.append(terResult.toString());
|
secResult.append(terResult);
|
||||||
primResult.append(secResult.toString());
|
primResult.append(secResult);
|
||||||
|
|
||||||
if (getStrength() == IDENTICAL) {
|
if (getStrength() == IDENTICAL) {
|
||||||
primResult.append((char)0);
|
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
|
// Internal objects that are cached across calls so that they don't have to
|
||||||
// be created/destroyed on every call to compare() and getCollationKey()
|
// be created/destroyed on every call to compare() and getCollationKey()
|
||||||
private StringBuffer primResult = null;
|
private StringBuilder primResult = null;
|
||||||
private StringBuffer secResult = null;
|
private StringBuilder secResult = null;
|
||||||
private StringBuffer terResult = null;
|
private StringBuilder terResult = null;
|
||||||
private CollationElementIterator sourceCursor = null;
|
private CollationElementIterator sourceCursor = null;
|
||||||
private CollationElementIterator targetCursor = null;
|
private CollationElementIterator targetCursor = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue