Nulls

Brian Goetz brian.goetz at oracle.com
Wed Sep 26 18:23:27 PDT 2012


> 3 -- if you can pull it off.

Having done a brief audit through the code, here are the places where 
the NPE is triggered not by user-provided code, but situationally:

  - Option-bearing findXxx -- this has already been discussed; if you 
have a stream that has nulls and non-nulls, its possible find might 
select a null, and then try to pass it to the Option ctor, which will 
NPE.  Workaround: filter out nulls with .filter(o -> o != null).

  - removeDuplicates.  As currently written, we'd NPE on null, but this 
can probably be addressed if we cared.

The rest of the cases would involve nulls being sent to lambdas or to 
collections that couldn't deal with it.



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