Hi Rémi!

On 26/06/2020 15:38, fo...@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

Reply via email to