Nulls

Joe Bowbeer joe.bowbeer at gmail.com
Sat Sep 22 10:55:15 PDT 2012


On Sat, Sep 22, 2012 at 10:39 AM, Brian Goetz wrote:

> This is a pretty simple (maybe simpler) rule:
>  - Streams are completely null-oblivious (we don't treat them specially at
> all)
>  - Option is null-hostile.
>
> The Stream just passes values along, null or not, whether it be to
> user-supplied lambdas, the Option ctor, the add() method of a collection
> provided to into(), etc; if that recipient can't handle it, it blows up
> there.  If that recipient wants to ignore nulls, that's OK too -- it's
> outside of the Streams API spec.  Then this mostly becomes a property of
> Optional.  (And, if we provide a default-bearing version too, if people
> want the null, they can use the other version.)



I like these rules.  The default-bearing version(s) can be emulated with
the Option version with an additional Option2Default transform stage, so I
would like to avoid the default-bearing version(s) if we can get away with
it.

Joe


More information about the lambda-libs-spec-observers mailing list