RFR: 8301226: Add clamp() methods to java.lang.Math and to StrictMath [v2]

Tagir F. Valeev tvaleev at openjdk.org
Tue Feb 7 13:32:44 UTC 2023


On Tue, 7 Feb 2023 13:09:39 GMT, ExE Boss <duke at openjdk.org> wrote:

>> @ExE-Boss which problem such an overload would solve? It looks like, `int clamp(long, int, int)` can be used everywhere where proposed `int clamp(int, int, int)` could be useful.
>
> A pure `int`‑only overload doesn’t have to go through the `int` → `long` → `int` conversion.

Is this a real problem?

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

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


More information about the core-libs-dev mailing list