Some very simple improvements regarding ArrayList
This commit is contained in:
committed by
Juergen Hoeller
parent
5e0cd9fb60
commit
92053bb84e
@@ -20,6 +20,7 @@ import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -373,12 +374,13 @@ public class MessageHeaderAccessor {
|
||||
}
|
||||
|
||||
private List<String> getMatchingHeaderNames(String pattern, @Nullable Map<String, Object> headers) {
|
||||
if (headers == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<String> matchingHeaderNames = new ArrayList<>();
|
||||
if (headers != null) {
|
||||
for (String key : headers.keySet()) {
|
||||
if (PatternMatchUtils.simpleMatch(pattern, key)) {
|
||||
matchingHeaderNames.add(key);
|
||||
}
|
||||
for (String key : headers.keySet()) {
|
||||
if (PatternMatchUtils.simpleMatch(pattern, key)) {
|
||||
matchingHeaderNames.add(key);
|
||||
}
|
||||
}
|
||||
return matchingHeaderNames;
|
||||
|
||||
Reference in New Issue
Block a user