brian.goetz at oracle.com
Sat Sep 22 09:47:08 PDT 2012
> I'd hate to have to put null checks in mapping functions, though.
That just move the null checks elsewhere.
If you don't want null checks in your mapping functions, and we're going
to allow nulls in streams, you can add a
.filter(e -> e != null)
to the top of the chain.
> about just "size-preserving in the absence of nulls"? I think of nulls
> as a case to be allowed but not encouraged.
That undermines a lot of valuable copy-avoidance optimizations.
> Can we really not find a way to pick just one of the first and third
> forms? Yes, I realize there is a subtle difference between "base" and
> "defaultValueIfNone", but I'm having trouble coming up with a realistic
> way to be bitten by this.
Yes, we can have one -- the two effectively mean the same thing. My
point was that the general "rule" being proposed only works for one of
the two things that currently return Optional.
More information about the lambda-libs-spec-observers