jshell> DoubleConsumer z = d -> System.out.println(d );
z ==> $Lambda$20/0x0000000800c09a00@443b7951
jshell> Consumer<Double> zz = d -> System.out.println(d);
zz ==> $Lambda$21/0x0000000800c0aa00@28c97a5
Auto-boxing and unboxing FTW, but either functional interface can work with either call due to unboxing and auto-boxing...
It is instructive to see why the two answers that really are wrong won't work:
C. Function<Long, Double>
D. Function<String, Double>
The functional interface of Function, regardless of type parameters, does not define a method named applyAsDouble() with any overload at all.
So attempts to call it using that method name will not compile.
The "primitive specializations" for consumer don't need a different name because they aren't returning anything, so they have no need to overload a method on return type (this is why a new name is needed for the primitive specializations for functional interfaces that need to return a value).
They don't need one, they don't have one, calling the same method with a primitive of the appropriate type works just great with auto-boxing as shown above.
Tho the question didn't ask that, notice that the one that is a primitive specialization works when passed a long because primitives can undergo widening conversions, e.g. long --> double
whereas it is good to see why this fails (you can't widen and auto-box in one step):
| incompatible types: long cannot be converted to java.lang.Double
Note this question didn't ask that, however.
RTFJD (the JavaDocs are your friends!) If you haven't read them in a long time, then RRTFJD (they might have changed!)