Merge pull request #13871 from dreis2211:collections-remove-if

* pr/13871:
  Polish "Use Collection.removeIf() where possible"
  Use Collection.removeIf() where possible
pull/14003/head
Stephane Nicoll 6 years ago
commit ee0de14e9f

@ -18,7 +18,6 @@ package org.springframework.boot.actuate.trace.http;
import java.net.URI; import java.net.URI;
import java.security.Principal; import java.security.Principal;
import java.util.Iterator;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -103,12 +102,7 @@ public class HttpExchangeTracer {
return new LinkedHashMap<>(); return new LinkedHashMap<>();
} }
Map<String, List<String>> headers = headersSupplier.get(); Map<String, List<String>> headers = headersSupplier.get();
Iterator<String> keys = headers.keySet().iterator(); headers.keySet().removeIf((header) -> !headerPredicate.test(header));
while (keys.hasNext()) {
if (!headerPredicate.test(keys.next())) {
keys.remove();
}
}
return headers; return headers;
} }

Loading…
Cancel
Save