-
Notifications
You must be signed in to change notification settings - Fork 3
Description
We could change the declaration of T to just <T>. That would be "simpler," and it could maybe in theory help someone who isn't realizing that the output is a Stream<@NonNull E> for some parametric-nullness type parameter E? But it might also annoy people who do actually want a Stream<SomeTypeThatMightIncludeNull>.
(TODO: Dig up past discussions of google/guava#1927 (comment) through the lens of nullness. The idea here would be that you can always map(t -> t) to change the type if you want to. [edit: Here we go: jspecify/jspecify#525. And I guess maybe this issue fits better in the jspecify/jspecify repo unless we do want to start using this repo's issues more?])
One thing to note is that the current signature works well for the Checker Framework for converting a Stream<@Nullable Foo> to a Stream<Foo> via flatMap(Stream::ofNullable). I imagine that the proposed signature would, too, but it would be good to check.