8293008: Replace uses of StringBuffer with StringBuilder in MergeCollation

Reviewed-by: rriggs, naoto, bpb
This commit is contained in:
Andrey Turbanov 2022-08-31 13:56:50 +00:00
parent 5d6779f709
commit 0d51f63a2e
2 changed files with 9 additions and 9 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 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
@ -86,7 +86,7 @@ final class MergeCollation {
* before & and < * before & and <
*/ */
public String getPattern(boolean withWhiteSpace) { public String getPattern(boolean withWhiteSpace) {
StringBuffer result = new StringBuffer(); StringBuilder result = new StringBuilder();
PatternEntry tmp = null; PatternEntry tmp = null;
ArrayList<PatternEntry> extList = null; ArrayList<PatternEntry> extList = null;
int i; int i;
@ -146,7 +146,7 @@ final class MergeCollation {
* builder. * builder.
*/ */
public String emitPattern(boolean withWhiteSpace) { public String emitPattern(boolean withWhiteSpace) {
StringBuffer result = new StringBuffer(); StringBuilder result = new StringBuilder();
for (int i = 0; i < patterns.size(); ++i) for (int i = 0; i < patterns.size(); ++i)
{ {
PatternEntry entry = patterns.get(i); PatternEntry entry = patterns.get(i);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 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
@ -52,14 +52,14 @@ class PatternEntry {
/** /**
* Gets the current extension, quoted * Gets the current extension, quoted
*/ */
public void appendQuotedExtension(StringBuffer toAddTo) { private void appendQuotedExtension(StringBuilder toAddTo) {
appendQuoted(extension,toAddTo); appendQuoted(extension,toAddTo);
} }
/** /**
* Gets the current chars, quoted * Gets the current chars, quoted
*/ */
public void appendQuotedChars(StringBuffer toAddTo) { private void appendQuotedChars(StringBuilder toAddTo) {
appendQuoted(chars,toAddTo); appendQuoted(chars,toAddTo);
} }
@ -83,7 +83,7 @@ class PatternEntry {
* For debugging. * For debugging.
*/ */
public String toString() { public String toString() {
StringBuffer result = new StringBuffer(); StringBuilder result = new StringBuilder();
addToBuffer(result, true, false, null); addToBuffer(result, true, false, null);
return result.toString(); return result.toString();
} }
@ -111,7 +111,7 @@ class PatternEntry {
// ===== privates ===== // ===== privates =====
void addToBuffer(StringBuffer toAddTo, void addToBuffer(StringBuilder toAddTo,
boolean showExtension, boolean showExtension,
boolean showWhiteSpace, boolean showWhiteSpace,
PatternEntry lastEntry) PatternEntry lastEntry)
@ -151,7 +151,7 @@ class PatternEntry {
} }
} }
static void appendQuoted(String chars, StringBuffer toAddTo) { private static void appendQuoted(String chars, StringBuilder toAddTo) {
boolean inQuote = false; boolean inQuote = false;
char ch = chars.charAt(0); char ch = chars.charAt(0);
if (Character.isSpaceChar(ch)) { if (Character.isSpaceChar(ch)) {