<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
On a side note, there are already Collections.min and Collections.max. We can use Collections.min(Arrays.asList(v1, v2, v3)) to find the minimum, too, and it works for antique Java versions.</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards, Chen</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> core-libs-dev <core-libs-dev-retn@openjdk.org> on behalf of Joseph D. Darcy <joe.darcy@oracle.com><br>
<b>Sent:</b> Friday, January 24, 2025 3:12 PM<br>
<b>To:</b> Aviad Zer <aviad1486@gmail.com>; core-libs-dev@openjdk.org <core-libs-dev@openjdk.org><br>
<b>Subject:</b> Re: Proposal to extend Math.min and Math.max to support multiple parameters</font>
<div> </div>
</div>
<div>
<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="x_moz-cite-prefix">On 1/22/2025 9:45 PM, Aviad Zer wrote:<br>
</div>
<blockquote type="cite">
<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)">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>
</div>
</body>
</html>