Initialize ArrayList with exact size in HttpHeaders
This commit is contained in:
committed by
Rossen Stoyanchev
parent
f60bec986f
commit
0d10d4beee
@@ -593,7 +593,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
|
|||||||
String value = getFirst(ACCESS_CONTROL_ALLOW_METHODS);
|
String value = getFirst(ACCESS_CONTROL_ALLOW_METHODS);
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
String[] tokens = StringUtils.tokenizeToStringArray(value, ",");
|
String[] tokens = StringUtils.tokenizeToStringArray(value, ",");
|
||||||
List<HttpMethod> result = new ArrayList<>();
|
List<HttpMethod> result = new ArrayList<>(tokens.length);
|
||||||
for (String token : tokens) {
|
for (String token : tokens) {
|
||||||
HttpMethod method = HttpMethod.valueOf(token);
|
HttpMethod method = HttpMethod.valueOf(token);
|
||||||
result.add(method);
|
result.add(method);
|
||||||
|
|||||||
Reference in New Issue
Block a user