RFR: JDK-8319123 : Implementation of JEP-461: Stream Gatherers (Preview)

Tagir F. Valeev tvaleev at openjdk.org
Wed Nov 8 15:41:40 UTC 2023


On Sun, 5 Nov 2023 17:17:43 GMT, Tagir F. Valeev <tvaleev at openjdk.org> wrote:

>> This is a Draft PR for [JEP-461](https://openjdk.org/jeps/461)
>
> src/java.base/share/classes/java/util/stream/Gatherer.java line 252:
> 
>> 250:      *         Gatherer as input that Gatherer
>> 251:      */
>> 252:     default <AA, RR> Gatherer<T, ?, RR> andThen(Gatherer<? super R, AA, ? extends RR> that) {
> 
> It would be great to remove AA type parameter, which is mentioned only once, so could be replaced with `?`. This will improve user experience if they happen to need to specify type parameters explicitly.

This is especially important given that often you don't know the AA type at all. E.g., imagine that you are doing `.andThen(Gatherers.fold(...))`, but `fold` returns `Gatherer<T, ?, R>`, so you can specify explicit `RR`, but not `AA`.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16420#discussion_r1386696219


More information about the core-libs-dev mailing list