|
18 | 18 | import static com.google.common.base.Preconditions.checkElementIndex; |
19 | 19 | import static com.google.common.base.Preconditions.checkNotNull; |
20 | 20 | import static com.google.common.base.Preconditions.checkPositionIndexes; |
21 | | -import static java.lang.Math.max; |
22 | | -import static java.lang.Math.min; |
23 | 21 |
|
24 | 22 | import com.google.common.annotations.GwtCompatible; |
25 | 23 | import com.google.common.annotations.GwtIncompatible; |
@@ -273,9 +271,11 @@ public static int max(int... array) { |
273 | 271 | * @throws IllegalArgumentException if {@code min > max} |
274 | 272 | * @since 21.0 |
275 | 273 | */ |
| 274 | + // A call to bare "min" or "max" would resolve to our varargs method, not to any static import. |
| 275 | + @SuppressWarnings("StaticImportPreferred") |
276 | 276 | public static int constrainToRange(int value, int min, int max) { |
277 | 277 | checkArgument(min <= max, "min (%s) must be less than or equal to max (%s)", min, max); |
278 | | - return min(max(value, min), max); |
| 278 | + return Math.min(Math.max(value, min), max); |
279 | 279 | } |
280 | 280 |
|
281 | 281 | /** |
@@ -453,8 +453,10 @@ private enum LexicographicalComparator implements Comparator<int[]> { |
453 | 453 | INSTANCE; |
454 | 454 |
|
455 | 455 | @Override |
| 456 | + // A call to bare "min" or "max" would resolve to our varargs method, not to any static import. |
| 457 | + @SuppressWarnings("StaticImportPreferred") |
456 | 458 | public int compare(int[] left, int[] right) { |
457 | | - int minLength = min(left.length, right.length); |
| 459 | + int minLength = Math.min(left.length, right.length); |
458 | 460 | for (int i = 0; i < minLength; i++) { |
459 | 461 | int result = Integer.compare(left[i], right[i]); |
460 | 462 | if (result != 0) { |
|
0 commit comments