Nulls
Brian Goetz
brian.goetz at oracle.com
Sun Sep 23 08:00:35 PDT 2012
> What I'm taking away from Doug's
> message is that there are *no* lambdas that can deal with nulls.
There's nothing intrinsically null-hostile about lambdas; lambdas are
basically methods, you can pass null into them and they can return null.
However, many naively-written lambdas (e.g., .map(e -> e.toString())
will throw when null is presented to them.
Again, this is not a problem when people expect nulls in their
collection. When people don't expect nulls -- which is most of the time
-- the reality is they'll get some unexpected NPE somewhere, and then
they can put
.filter(o != null)
in their pipeline.
More information about the lambda-libs-spec-experts
mailing list