oh, sorry Mike, I see what you mean, reduce would work on a NonEmptyIterable, I thought you meant as a return from
sequence.reduce
n
nfrankel
09/06/2019, 7:27 PM
yep
nobody seemed to care about my point 😂
d
dr.dreigh
09/06/2019, 7:28 PM
I do, but I'm a little biased, if it was me there would be no runtime exceptions in the std lib
n
nfrankel
09/06/2019, 7:39 PM
thanks for the support 🙂
i was actually searching for insights from the developers
they probably could have told why they designed it like that
and perhaps think about making more robust
i think it’s the first time i discover something done better in the java api
d
dr.dreigh
09/06/2019, 8:15 PM
I think it must be an omission/bug. the min/max/maxBy/etc methods on a sequence of comparable T, return
T?
dr.dreigh
09/06/2019, 8:17 PM
It seems additionally counter intuitive because, the only way to know it is not-empty is to start to consume/evaluate it before reducing. Which might not be desirable as sequences are non strict.