Initialize ArrayList with exact size in HttpHeaders

This commit is contained in:
Patrick Strawderman 2023-02-21 20:43:32 -08:00 committed by Rossen Stoyanchev
parent f60bec986f
commit 0d10d4beee
1 changed files with 1 additions and 1 deletions

View File

@ -593,7 +593,7 @@ public class HttpHeaders implements MultiValueMap<String, String>, Serializable
String value = getFirst(ACCESS_CONTROL_ALLOW_METHODS);
if (value != null) {
String[] tokens = StringUtils.tokenizeToStringArray(value, ",");
List<HttpMethod> result = new ArrayList<>();
List<HttpMethod> result = new ArrayList<>(tokens.length);
for (String token : tokens) {
HttpMethod method = HttpMethod.valueOf(token);
result.add(method);