On Wed, 11 Feb 2026 13:47:17 GMT, jengebr <[email protected]> wrote:

>> src/java.base/share/classes/java/util/HashMap.java line 516:
>> 
>>> 514:      */
>>> 515:     final void putMapEntries(Map<? extends K, ? extends V> m, boolean 
>>> evict) {
>>> 516:         if (m.getClass() == Collections.UnmodifiableMap.class) {
>> 
>> I would address that issue in a separate bug.
>
> What issue?  This is an integral part of the performance optimization.

Your PR proposes two optimizations,
- HashMap.putAll(HashMap) 
- HashMap.putAll(UnmodifiableMap(HashMap))
 
The former have been done numerous time for other collections, the latter is as 
far as as know new.

There are several reasons to not wanting to do the latter , on top of my head:
- this is not a symmetrical transformation,
- why only have this optimization on HashMap and not ArrayList and/or 
ArrayDeque ? 

So It's a separate issue that should be discussed on on the mailist list first.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28243#discussion_r2794933915

Reply via email to