On Sat, 9 Apr 2022 04:33:00 GMT, liach <d...@openjdk.java.net> wrote:
> Quick question: If the maps are intended to be fixed-size, can't the users > just call `new HashMap<>(size, 1)`, increasing the growth factor to prevent > growth? @liach this questions equals question : "why default load factor be 0.75 not 1" In short, when larger the load factor, smaller memory use, and larger hash-collide rate, larger crud time cost. when smaller the load factor, larger memory use, and smaller hash-collide rate, smaller crud time cost. As for why default load factor be 0.75 but not 1, it is historical to me. it is already 0.75 when I first learn java and never changed then. But I guess there be some empirical formula behind it. ------------- PR: https://git.openjdk.java.net/jdk/pull/7928