Nulls

Tim Peierls tim at peierls.net
Sat Sep 22 18:12:29 PDT 2012


Works for me.

Btw, the syntax I use for default values currently:

  Result result = stream.findFirst(pred).or(defaultResult);

I like that.

--tim

On Sat, Sep 22, 2012 at 1:55 PM, Joe Bowbeer <joe.bowbeer at gmail.com> wrote:

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


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