RFR: 8180352: Add Stream.toList() method

Stuart Marks stuart.marks at oracle.com
Tue Nov 3 23:41:46 UTC 2020



On 11/3/20 3:10 AM, Florian Weimer wrote:
> I'd expect a test here that if the list contains a null element, `List::copyOf` throws `NullPointerException`.

The new Stream.toList() actually permits null elements (by design) so it goes 
through a different path than List::copyOf. The new tests' data provider does 
include nulls in the input, and these should be accepted.

Rejection of nulls for List::copyOf is be handled by tests in

test/jdk/java/util/List/ListFactories.java

s'marks


More information about the core-libs-dev mailing list