On Tue, 14 Sep 2021 13:38:27 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:
>> src/jdk.httpserver/share/classes/com/sun/net/httpserver/Headers.java line >> 106: >> >>> 104: var h = headers.entrySet().stream() >>> 105: .collect(Collectors.toUnmodifiableMap( >>> 106: Entry::getKey, e -> new >>> LinkedList<>(e.getValue()))); >> >> I wonder, what the reason of `LinkedList` usages here? >> As I know ArrayList is faster in all real-world scenarios. > > Hi Andrey, IIRC from when I reviewed this code the current implementation of > `Headers` already uses `LinkedList` in other places - so this preserves the > concrete list implementation class that `Headers` uses (see `Headers::add`). > Not that it matters much - but if we wanted to replace `LinkedList` with > `ArrayList` I believe we should do it consistently in this class - and > probably outside of the realm of this JEP. That's right, it's due to the pre-existing implementation. ------------- PR: https://git.openjdk.java.net/jdk/pull/5505