RFR: 8281631: HashMap.putAll can cause redundant space waste
stefan-zobel
duke at openjdk.java.net
Fri Feb 11 11:58:09 UTC 2022
On Thu, 10 Feb 2022 18:09:19 GMT, XenoAmess <duke at openjdk.java.net> wrote:
> I investigated most of the usages. They just give a size, and get a capacity, even not change the 0.75 So maybe we can use some int calculation to replace the 0.75, thus replace Math.ceil for such situations.
FWIW, `(int) Math.ceil(expected / 0.75)` and `(int) ((expected * 4L + 2L) / 3L)` would be equivalent.
-------------
PR: https://git.openjdk.java.net/jdk/pull/7431
More information about the core-libs-dev
mailing list