http-client-branch: HttpHeadersImpl use more efficient entrySet http-client-branch
authorchegar
Mon, 05 Feb 2018 19:09:31 +0000
branchhttp-client-branch
changeset 56073 38d25d0eeae8
parent 56072 96c1f6e984eb
child 56074 06459c34105f
http-client-branch: HttpHeadersImpl use more efficient entrySet
src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/HttpHeadersImpl.java
--- a/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/HttpHeadersImpl.java	Mon Feb 05 19:01:54 2018 +0000
+++ b/src/jdk.incubator.httpclient/share/classes/jdk/incubator/http/internal/common/HttpHeadersImpl.java	Mon Feb 05 19:09:31 2018 +0000
@@ -53,11 +53,9 @@
 
     public HttpHeadersImpl deepCopy() {
         HttpHeadersImpl h1 = new HttpHeadersImpl();
-        Set<String> keys = headers.keySet();
-        for (String key : keys) {
-            List<String> vals = headers.get(key);
-            List<String> vals1 = new ArrayList<>(vals);
-            h1.headers.put(key, vals1);
+        for (Map.Entry<String,List<String>> entry : headers.entrySet()) {
+            List<String> valuesCopy = new ArrayList<>(entry.getValue());
+            h1.headers.put(entry.getKey(), valuesCopy);
         }
         return h1;
     }