RFR(s): 8140281 add no-arg Optional.orElseThrow() as preferred alternative to get()
forax at univ-mlv.fr
Fri Dec 8 09:35:27 UTC 2017
----- Mail original -----
> De: "Alan Bateman" <Alan.Bateman at oracle.com>
> À: "Stuart Marks" <stuart.marks at oracle.com>, "core-libs-dev" <core-libs-dev at openjdk.java.net>
> Envoyé: Vendredi 8 Décembre 2017 10:10:15
> Objet: Re: RFR(s): 8140281 add no-arg Optional.orElseThrow() as preferred alternative to get()
> On 08/12/2017 00:33, Stuart Marks wrote:
>> Hi all,
>> Please review this changeset that introduces a new no-arg method
>> orElseThrow() to Optional, as a preferred alternative to the get()
> This looks good. The naming is consistent and I think better than the
> "getWhenPresent" proposed in the original thread.
i agree with Alan.
Having a name that starts with "get" as the great advantage as to be visible in the IDE completion box just after the method get() so it will help people to transition from get() to getWhenPresent()
BTW, i do not see the point to not deprecate get() at the same time.
More information about the core-libs-dev