RFR: 8273349: Check uses of Stream::peek in controls and replace as needed [v3]

drmarmac duke at openjdk.org
Thu Mar 28 22:24:37 UTC 2024


On Thu, 28 Mar 2024 17:53:14 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> drmarmac has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Preallocate in SelectedIndicesList.set()
>>  - Remove unused import
>
> modules/javafx.controls/src/main/java/javafx/scene/control/ControlUtils.java line 166:
> 
>> 164:             sm.startAtomic();
>> 165: 
>> 166:             final List<Integer> removed = new ArrayList<>(c.getRemovedSize());
> 
> I wonder if we should add a check for 0 size here to bypass all this code and unnecessary object allocations if nothing is removed (same for added)

We certainly could, or maybe use wasRemoved(), but I doubt there will be much impact. I guess it's preferred to keep changes unrelated to the issue minimal, so I'd leave it as it is if everyone's ok with that.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1430#discussion_r1543790719


More information about the openjfx-dev mailing list