Java/List.ofはnon-nullableだがStream.ofはnullable
code:txt
jshell> String a = "1";
a ==> "1"
jshell> String b = "2";
b ==> "2"
jshell> String c = "3";
c ==> "3"
jshell> Stream.of(a,b,c).toList();
jshell> c = null;
c ==> null
jshell> Stream.of(a,b,c).toList();
jshell> List.of(a,b,c);
| 例外java.lang.NullPointerException
| at Objects.requireNonNull (Objects.java:233)
| at ImmutableCollections.listFromTrustedArray (ImmutableCollections.java:215)
| at List.of (List.java:972)
| at (#7:1)