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

Karthik P K kpk at openjdk.org
Thu Mar 28 06:11:34 UTC 2024


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

>> `forEach` is void, so we can not return a list afterwards.
>
> You don't need to return a list, you create it ahead of time like was done in line 167
> 
> List<Integer> indices = new ArrayList<>();
> 
> and the add the elements in `forEach`.

> Why do the double-iteration pattern here and not do the `peek` operation in a `forEach` like in the other 2 places?

Yes, if the usage of `forEach` in previous 2 places are correct then I would like to see similar change here as well.

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

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


More information about the openjfx-dev mailing list