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

Aviad Zer duke at openjdk.org
Sat Jan 18 12:40:07 UTC 2025


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.

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

Commit messages:
 - Extend Math.min to support unlimited parameters for int, double, long, and float

Changes: https://git.openjdk.org/jdk/pull/23138/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23138&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8348030
  Stats: 72 lines in 1 file changed: 72 ins; 0 del; 0 mod
  Patch: https://git.openjdk.org/jdk/pull/23138.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/23138/head:pull/23138

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


More information about the core-libs-dev mailing list