Re: RFR[8238286]: 'Add new flatMap stream operation that is more amenable to pushing’
Daniel Fuchs
daniel.fuchs at oracle.com
Thu Jun 25 09:28:00 UTC 2020
Hi Rémi,
On 25/06/2020 00:32, Remi Forax wrote:
> I get that you want to keep Consumer<R> instead of Consumer<? super R> because Consumer<? super R> is not a valid target type for a lambda, but the BiConsumer should be able to take a ? super Consumer<R> instead of just Consumer<R>.
Though I don't dispute that a strict application of the rules of
covariance and contravariance would require to design a signature
that accepts a `? super Consumer<R>` - how would you implement a
BiConsumer with a signature that doesn't take a Consumer<R>?
Such an implementation would be unable to push anything downstream
without having to cast back the consumer to Consumer<R>.
My personal preference would be to vote in favor of the simpler
signature - which IMO is more readable and easier to understand.
best regards,
-- daniel
More information about the core-libs-dev
mailing list