On Tue, 15 Nov 2022 20:26:37 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> src/jdk.incubator.concurrent/share/classes/jdk/incubator/concurrent/ScopedValue.java
>>  line 613:
>> 
>>> 611:      * @return the value of the scoped value if bound, otherwise 
>>> {@code other}
>>> 612:      */
>>> 613:     public T orElse(T other) {
>> 
>> From an API perspective, wouldn't return `Optional` a more consistent 
>> choice? `Optional` has all methods we need to deal with this kind of stuff...
>
> This comment is on orElse but I suspect you are suggesting that get() be 
> changed to return Optional. I think we'll need to get more feedback/usage of 
> this API before re-visiting that.

Yes, my comment was really on `get` - that said, I note that saying get().get() 
would look odd (but maybe finding some other name for `ScopedValue::get`, such 
as `find` might work)

-------------

PR: https://git.openjdk.org/jdk/pull/10952

Reply via email to