On Wed, 24 Jan 2024 19:55:27 GMT, Chen Liang <li...@openjdk.org> wrote:
> Then we might need some statistics on how often `putAll` replaces existing > mappings, ranging from none at all to completely. For example, > `Collectors.toMap` would never replace existing mappings, even though it > doesn't use `putAll` (it can probably call putAll and throw exception if the > new size isn't 2 old sizes added up) > > The current allocation assumes putting replaces all existing mappings, which > I don't think is quite applicable. I do not think we care whetherd mappings are getting replaced. We care about the number of unique keys between the two maps, which determines the final size of the map. ------------- PR Comment: https://git.openjdk.org/jdk/pull/17544#issuecomment-1908904298