Prefer Math#clamp

MSAL

Prefer java.lang.Math#clamp instead of using com.google.common.primitives.*#constrainToRange.

org.openrewrite.java.migrate.guava.PreferMathClamp
mod run . --recipe=org.openrewrite.java.migrate.guava.PreferMathClamp

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.

Recipe list

It runs these recipes, in this order.

  1. Change method name com.google.common.primitives.Doubles constrainToRange(..) to clamp
  2. Change method target to static
  3. Change method name com.google.common.primitives.Floats constrainToRange(..) to clamp
  4. Change method target to static
  5. Change method name com.google.common.primitives.Longs constrainToRange(..) to clamp
  6. Change method target to static