----- Mail original ----- > De: "Daniel Fuchs" <daniel.fu...@oracle.com> > À: "Remi Forax" <fo...@univ-mlv.fr>, "Patrick Concannon" > <patrick.concan...@oracle.com> > Cc: "core-libs-dev" <core-libs-dev@openjdk.java.net> > Envoyé: Jeudi 25 Juin 2020 11:28:00 > Objet: Re: RFR[8238286]: 'Add new flatMap stream operation that is more > amenable to pushing’
> Hi Rémi, Hi Daniel, > > 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>. if i have already have a BiConsumer<Consumer<Object>, Object>, i would like to be able to call Stream<String>.mapMulti() with that bi-consumer as argument. > > My personal preference would be to vote in favor of the simpler > signature - which IMO is more readable and easier to understand. > > best regards, regards, Rémi > > -- daniel