RFR(s): 8152617 add missing wildcards to Optional or() and flatMap()

Stefan Zobel spliterator at gmail.com
Fri Oct 7 22:12:23 UTC 2016

Hi Stuart,

thanks for explaining.

> ... After having looked at lots of generic APIs, it seems to me that a
> style has emerged where wildcards are used whenever possible, and type
> parameters are used only when necessary, ...

Yes, I'm familiar with that kind of reasoning (I think Josh Bloch stated
that principle in "Effective Java"). But, to be honest, I never thought
that it should apply as a strict rule in all circumstances.

Rhetorical question: do you really think that a signature employing 3
wildcards is easier to understand for the proverbial "average Joe" than
a bounded type parameter that expresses the sub-type relationship clearly?
I do not.

But anyway, you probably have to follow the established "style".

It's just too bad that most Java programmers I know won't understand the
proposed signature of 'flatMap'.

Kind regards,

More information about the core-libs-dev mailing list