On Tue, 24 Mar 2026 20:13:55 GMT, Andy Goryachev <[email protected]> wrote:
>> It's probably more about the increased cognitive load, as you now need to
>> first check the method and remember what it does. And the size of the class.
>>
>> Should I put this on my list for potential future improvements to the test
>> setup @andy-goryachev-oracle ?
>
> I just can't believe that one function requires more cognitive load than a
> bunch of long sequential lines (are they the same? different? do I need to
> check character by character)?
>
> It's a minor annoyance, so it's up to the author really. There is no runtime
> impact, I think.
>
> But I will complain about poorly formatted lambdas each time.
There is some interesting research about this matter - like how much things we
can remember at once when reading code and so on. I took that from there.
In any case, it is a matter of taste.
For me, the `IntStream` is a common pattern so I do not see how a utility
method helps, other then making the class bigger with a method that is used in
4/80 tests (as an example).
Same for lambdas, big lambdas inline are IMHO not readable anymore, especially
with many if-else. A method reference will help a lot, since the method name
should already provide some information.
Regarding lambda fomratting, I don't use the `{..}` if I don't need to. It will
just add extra clutter for no improvement. And IntelliJ also marks that as 'can
be removed, not needed for a single line'. And I agree with that.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2118#discussion_r2984047910