On Tue, 24 Mar 2026 20:20:37 GMT, Marius Hanl <[email protected]> wrote:

>> 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.

inability to set a breakpoint on a lambda in some IDEs is not exactly a matter 
of taste, but of convenience.  thanks for making my life less convenient.

I still can't believe `IntStream.range(0, 15).boxed().map(integer -> "Item " + 
integer).toList()` is considered to have less cognitive load than a simple 
function call.  it's hilarious!  :-)

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2118#discussion_r2984090983

Reply via email to