<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body>
    <p>Hello Aviad,</p>
    <p>A brief reply here, there is some utility in having direct
      support for finding the min or max over an aggregate of data and
      min/max methods taking an array is something that could have been
      added to the platform at any point since its inception. The fact
      that such methods weren't added before doesn't completely rule out
      adding them now, but does give pause. Additionally, with streams
      finding the min/max is an easy operation so I would see less
      justification to adding array-based min/max in JDK 25+ than before
      streams were added in JDK 8.</p>
    <p>An analysis showing existing use of array-based min/max method as
      JDK-internal APIs would strengthen the case, but I believe the
      default solution at this point is "use streams."</p>
    <p>HTH,<br>
    </p>
    <p>-Joe<br>
    </p>
    <div class="moz-cite-prefix">On 1/22/2025 9:45 PM, Aviad Zer wrote:<br>
    </div>
    <blockquote type="cite" cite="mid:CAMEfB3MX57jsti--79gD8X-JovBm5HoxPyFf9fDGkXba31akBg@mail.gmail.com">
      
      <div dir="auto">
        <p style="font-size:12.8px">Dear Core-Libs Dev Team,</p>
        <p style="font-size:12.8px">I hope this message finds you well.</p>
        <p style="font-size:12.8px">I would like to propose an
          enhancement to the <code>Math</code> class to extend the <code>Math.min</code> and <code>Math.max</code> methods
          to support multiple parameters using varargs. This enhancement
          aims to improve code readability and provide a more intuitive
          way to find the minimum or maximum value among multiple
          numbers without requiring nested calls or external logic.</p>
        <p style="font-size:12.8px">Motivation:<br>
          Currently, developers must either nest multiple calls to <code>Math.min</code> or
          use the Streams API (<code>Arrays.stream(values).min()</code>),
          which can feel cumbersome for simple cases. By introducing
          varargs-based <code>Math.min</code> and <code>Math.max</code> methods
          for <code>int</code>, <code>long</code>, <code>float</code>,
          and <code>double</code>, this proposal simplifies the process
          and aligns with the expected functionality of these utility
          methods.</p>
        <p style="font-size:12.8px">Current Progress:<br>
          I have submitted a pull request for this enhancement: <a href="https://github.com/openjdk/jdk/pull/23138" style="text-decoration-line:none;color:rgb(66,133,244)" moz-do-not-send="true">PR #23138</a>. The PR includes:</p>
        <ul style="font-size:12.8px">
          <li style="margin-right:15px">Implementation of <code>Math.min</code> and <code>Math.max</code> with
            varargs for <code>int</code>, <code>long</code>, <code>float</code>,
            and <code>double</code>.</li>
        </ul>
        <p style="font-size:12.8px">Feedback and Next Steps:<br>
          I am reaching out to gather your feedback on this proposal and
          determine whether this enhancement aligns with the goals of
          the core-libs. I understand that significant changes like this
          may require a CSR, and I am fully prepared to follow the
          process once I have a response from the community.</p>
        <p style="font-size:12.8px">Thank you for your time and
          consideration. I look forward to hearing your thoughts and
          engaging with the community on this proposal.</p>
        <p style="font-size:12.8px">Best regards,</p>
        <p style="font-size:12.8px">Aviad Zer</p>
      </div>
    </blockquote>
  </body>
</html>