On Sat, 3 Aug 2024 10:08:14 GMT, Michael Strauß <[email protected]> wrote:
>> modules/javafx.graphics/src/main/java/javafx/scene/Node.java line 9020:
>>
>>> 9018: if (timer != null) {
>>> 9019: if (result == null) {
>>> 9020: result = new HashMap<>(5);
>>
>> I think that when you specify map sizes like this, it might be worth a
>> comment at the intent. Did you intend to create a map that can hold 6 items
>> before resizing? (5 becomes 8, which is sufficient for 6 mappings with a
>> 75% load factor). If you want to express the intent more clearly, use
>> `HashMap.newHashMap(5)`.
>
> I feel that the default initial capacity of 16 is more than can be reasonably
> expected for transitions. However, I did not use any rigorous methodology to
> come up with the number 5. I can add a comment, though.
I've added a comment and switched to `HashMap.newHashMap` as you suggested.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1522#discussion_r1703353352