RFR: JDK-8348030 : Extend Math.min to support multiple parameters

Per Minborg pminborg at openjdk.org
Mon Jan 20 08:39:37 UTC 2025


On Wed, 15 Jan 2025 14:26:32 GMT, Aviad Zer <duke at openjdk.org> wrote:

> This change extends the Math.min function to support multiple parameters, improving its usability and code readability.
> 
> Previously, finding the minimum value among multiple variables required using nested Math.min calls or converting the variables into an array and iterating through it. This enhancement provides a more intuitive and straightforward approach to achieve the same result.
> 
> Benefits:
> 
> Simplifies code by eliminating the need for nested Math.min calls.
> Enhances readability, especially when comparing multiple values.
> Offers consistency with existing Math.min usage patterns.

Was this proposal discussed before providing this PR?  Why is just `min()` proposed to change and not others like `max()` and `addExact()`? This PR would require a [CSR](https://wiki.openjdk.org/display/csr/CSR+FAQs) to be filed.

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

PR Comment: https://git.openjdk.org/jdk/pull/23138#issuecomment-2601749527


More information about the core-libs-dev mailing list