mirror of
https://github.com/elastic/elasticsearch.git
synced 2025-06-28 01:22:26 -04:00
Use StringBuilder instead of StringBuffer (#128665)
This commit is contained in:
parent
5a4c42819f
commit
d597e50117
9 changed files with 16 additions and 16 deletions
|
@ -456,10 +456,10 @@ public class Augmentation {
|
|||
public static String replaceAll(CharSequence receiver, Pattern pattern, Function<Matcher, String> replacementBuilder) {
|
||||
Matcher m = pattern.matcher(receiver);
|
||||
if (false == m.find()) {
|
||||
// CharSequqence's toString is *supposed* to always return the characters in the sequence as a String
|
||||
// CharSequence's toString is *supposed* to always return the characters in the sequence as a String
|
||||
return receiver.toString();
|
||||
}
|
||||
StringBuffer result = new StringBuffer(initialBufferForReplaceWith(receiver));
|
||||
StringBuilder result = new StringBuilder(initialBufferForReplaceWith(receiver));
|
||||
do {
|
||||
m.appendReplacement(result, Matcher.quoteReplacement(replacementBuilder.apply(m)));
|
||||
} while (m.find());
|
||||
|
@ -477,7 +477,7 @@ public class Augmentation {
|
|||
// CharSequqence's toString is *supposed* to always return the characters in the sequence as a String
|
||||
return receiver.toString();
|
||||
}
|
||||
StringBuffer result = new StringBuffer(initialBufferForReplaceWith(receiver));
|
||||
StringBuilder result = new StringBuilder(initialBufferForReplaceWith(receiver));
|
||||
m.appendReplacement(result, Matcher.quoteReplacement(replacementBuilder.apply(m)));
|
||||
m.appendTail(result);
|
||||
return result.toString();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue