On Wed, 17 Sep 2025 13:58:03 GMT, Roger Riggs <[email protected]> wrote:

>> I don't understand. Let's consider an example:
>> 
>>     jshell> import java.time.*
>>     
>>     jshell> var i = Instant.now();
>>     i ==> 2025-09-16T21:44:06.464393Z
>>     
>>     jshell> Duration.between(i, i).abs().isPositive()
>>     $3 ==> false
>> 
>> So, `abs()` does not translate any duration into positive duration. There 
>> exists duration `d` such that `!d.abs().isPositive()`. Any duration for 
>> which `d.equals(Duration.ZERO)` is like that.
>
> Joe's suggestion of "non-negative" (instead of positive) is probably the best 
> replacement.
> 
> Mentioning using `abs()` with a zero argument didn't parse well.

Okay, but don't we need some verbiage -- however little -- on what 
"non-negative" means for Duration, or we consider it self-evident? (Genuine 
question.)

Can we also tie this change with "positive or negative" for primitive 
components?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/27296#discussion_r2355757830

Reply via email to