# HG changeset patch # User chegar # Date 1517857771 0 # Node ID 38d25d0eeae8301c9c7920d863132f405af54ef8 # Parent 96c1f6e984ebf9717def37a1a95b267e73fbceef http-client-branch: HttpHeadersImpl use more efficient entrySet diff -r 96c1f6e984eb -r 38d25d0eeae8 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 keys = headers.keySet(); - for (String key : keys) { - List vals = headers.get(key); - List vals1 = new ArrayList<>(vals); - h1.headers.put(key, vals1); + for (Map.Entry> entry : headers.entrySet()) { + List valuesCopy = new ArrayList<>(entry.getValue()); + h1.headers.put(entry.getKey(), valuesCopy); } return h1; }