RFR(m): 8140281 deprecate Optional.get()
Stuart Marks
stuart.marks at oracle.com
Thu Apr 28 23:55:49 UTC 2016
On 4/28/16 4:05 AM, Stanislav Baiduzhyi wrote:
> Those examples are amazing. Would it be possible to expand Optional
> class javadoc with some of those examples? First, second, and the last
> one are the most descriptive in my opinion. I frowned at Optional for
> so long, you just showed me that I was not using it properly.
Yes, this is a good point, independent of deprecation of get() and addition of
new/replacement methods such as getWhenPresent(). It does seem really hard to
look at the API docs for Optional and to figure out how they're intended to be
used. While the javadocs aren't the right place for a tutorial, it's certainly
reasonable to have a few small examples in key places.
I've filed JDK-8155693 to track this.
s'marks
More information about the core-libs-dev
mailing list