On Fri, 11 Feb 2022 15:04:03 GMT, Roger Riggs <rri...@openjdk.org> wrote:
> if size were Integer.MAX_VALUE / 2; the computation would overflow Actually will not, it must be slightly larger. it will only overflow when it be larger than Integer.MAX_VALUE * 0.75 But yes, it can overflow when there be a map as large as that. > Using Long for the computation would avoid that and keep the expression > simple. but it be slower. I do think a int check can do same thing, and would add it . Thanks! ------------- PR: https://git.openjdk.java.net/jdk/pull/7431