https://bz.apache.org/bugzilla/show_bug.cgi?id=68546
--- Comment #8 from John Engebretson <jeng...@amazon.com> --- This is an interesting callout, thanks - I assumed that `HashMap`/`LinkedHashMap` viewed initialCapacity as the number of entries to hold, and calculated the array size separately using initialCapacity and loadfactor as you illustrated. Looking at JVM source, that is not the case. However, `HashMap(int, float)` delegates the calculation to a static utility method, `tableSizeFor(int)` which rounds up to the lowest power of two >= the requested capacity. That will hide some of the penalty from the error. Other thoughts: 1. I *think* the impact of this is small, thanks to the power-of-two. Small is greater than zero. 2. Directly calculating the length of an internal table feels wrong, but will produce the best possible outcome. The power of two logic will often result in wasted space regardless but it's still better than not providing the capacity hint. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org