>
> Turns out that Rémi's example exposes the difference between the wildcard
> approach and the type-parameter approach. Returning to the example,
>
>     Optional<Integer> oi = Optional.empty();
>     Function<Number, Optional<StringBuilder>> fm = n -> Optional.empty();
>     Optional<CharSequence> ocs = oi.flatMap(fm);
>
> If the flatMapper function itself has a wildcard type, for example,
>
>     Function<Number, Optional<? extends CharSequence>> fm = n ->
> Optional.empty();
>
> then this will still work with the wildcard approach but fail with the
> type-parameter approach. As Rémi also pointed out, a wildcarded type can
> result from the capture of a type with a wildcarded type parameter.
>
> Based on this, I believe the nested wildcard approach to be the correct one.
>
> s'marks
>

Yes, this argument is unchallengeable.
I'm convinced now - though not happy.

Kind regards,
Stefan

Reply via email to