Use StringBuilder.append(char) where possible
To slightly improve performance, this commit switches to StringBuilder.append(char) instead of StringBuilder.append(String) whenever we append a single character to a StringBuilder. Closes gh-27098
This commit is contained in:
@@ -380,7 +380,7 @@ public final class RequestMappingInfo implements RequestCondition<RequestMapping
|
||||
}
|
||||
if (!this.patternsCondition.isEmpty()) {
|
||||
Set<PathPattern> patterns = this.patternsCondition.getPatterns();
|
||||
builder.append(" ").append(patterns.size() == 1 ? patterns.iterator().next() : patterns);
|
||||
builder.append(' ').append(patterns.size() == 1 ? patterns.iterator().next() : patterns);
|
||||
}
|
||||
if (!this.paramsCondition.isEmpty()) {
|
||||
builder.append(", params ").append(this.paramsCondition);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -353,7 +353,7 @@ public class BindStatus {
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("BindStatus: ");
|
||||
sb.append("expression=[").append(this.expression).append("]; ");
|
||||
sb.append("value=[").append(this.value).append("]");
|
||||
sb.append("value=[").append(this.value).append(']');
|
||||
if (!ObjectUtils.isEmpty(this.errorCodes)) {
|
||||
sb.append("; errorCodes=").append(Arrays.asList(this.errorCodes));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -154,7 +154,7 @@ class FlushingIntegrationTests extends AbstractHttpHandlerIntegrationTests {
|
||||
for (char c : "0123456789".toCharArray()) {
|
||||
sb.append(c);
|
||||
if (sb.length() + 1 == 1024) {
|
||||
sink.next(sb.append("\n").toString());
|
||||
sink.next(sb.append('\n').toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user