Doug Lea dl at
Mon Sep 24 06:17:04 PDT 2012

On 09/23/12 10:10, Tim Peierls wrote:
> Brian said:
>     I would rather not punish everyone because some idiot puts nulls in a
>     collection and that same idiot filters/maps it with lambdas that can't deal
>     with nulls.
> and I'm solidly behind that.

Fun fact: ignoring nulls is in general (barely) cheaper than
throwing NPEs on null. And JVMs will perform null
checks at some point on any dereferenced argument for
user-supplied lambda unless subsumed by an explicit check
they can piggy-back on.

So if "punish" means poorer performance, then I don't see
the argument. My suggested implementation strategy of
throwing away work in a few ops only on seeing null likely
has no measurable performance impact except on those people
who do have null elements.


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