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

Marius Hanl mhanl at openjdk.org
Wed Mar 27 23:27:35 UTC 2024


On Wed, 27 Mar 2024 13:41:21 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

> That's still 2 iterations.

Yes, but one advantage here:
We currently do `final List<Integer> removed = new ArrayList<>(c.getRemovedSize());`, 
where we allocate a list with a size, that is probably too big since we filter the removed items.
So with `toList`, we at least get back a list with the correct size.
But true, that we technically iterate twice then. It probably does not matter too much.

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

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


More information about the openjfx-dev mailing list