Re: RFR[8238286]: 'Add new flatMap stream operation that is more amenable to pushing’
Daniel Fuchs
daniel.fuchs at oracle.com
Fri Jun 26 15:13:05 UTC 2020
Hi Rémi!
On 26/06/2020 15:38, forax at univ-mlv.fr wrote:
> for your first example, the only valid value for Consumer<?> is null, so consumer.accept(null) should work.
> for the second example, Consumer<? super String> accepts any subtypes of String, given that String is final, the only possible type is String, so consumer.accept(o.toString()) should work.
>
> BTW, you may think that nobody will create voluntarily a BiConsumer<Consumer<? super String >, Object>, and that's true, usually you get this kind of types as result of method call inference,
> e.g. you have a function g(f(Consumer<? super T>)) with T=String and g signature being something like <E> BiConsumer<E, Object> g(E element).
Thanks for the detailed explanations!
OK - you have convinced me. I'll reluctantly withdraw my objection then ;-)
best regards,
-- daniel
More information about the core-libs-dev
mailing list