RFR(m): 8140281 deprecate Optional.get()

Mario Torre neugens.limasoftware at gmail.com
Wed Apr 27 17:49:43 UTC 2016


2016-04-27 19:43 GMT+02:00 Maurizio Cimadamore <maurizio.cimadamore at oracle.com>:
>
>
> On 27/04/16 09:31, Andrew Haley wrote:
>>
>> what they say makes
>> sense to me
>
> It makes sense to me to. Having an innocently-named get() method throwing an
> exception is not something you see everyday. And in this case it's doubly
> confusing because one could imagine also a different behavior (i.e. return
> null if no object is there). So I'm in favor for making things clearer by
> choosing a more explicit name (whether the proposed one or a better one).

This thread looks funny, so I chime in too.

+1 for the change overall, I really do like when methods are self
explanatory and I don't need to read the manual ;)

But please consider the getWhenPresent sounds to me like it's trying
to suggest that the method would block and returns *when* the value is
present, not sure if it's just me and the fact that I'm not native
english speaker though.

Cheers,
Mario

-- 
pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF
Fingerprint: BA39 9666 94EC 8B73 27FA  FC7C 4086 63E3 80F2 40CF

Java Champion - Blog: http://neugens.wordpress.com - Twitter: @neugens
Proud GNU Classpath developer: http://www.classpath.org/
OpenJDK: http://openjdk.java.net/projects/caciocavallo/

Please, support open standards:
http://endsoftpatents.org/



More information about the core-libs-dev mailing list