Use "forEach" syntax.

This commit is contained in:
Gilles Sadowski 2023-01-06 03:49:01 +01:00
parent 423b72ff8d
commit b05b58d2fd
1 changed files with 8 additions and 8 deletions

View File

@ -552,9 +552,9 @@ public final class MathArrays {
* @since 3.1 * @since 3.1
*/ */
public static void checkPositive(final double[] in) { public static void checkPositive(final double[] in) {
for (int i = 0; i < in.length; i++) { for (double x : in) {
if (in[i] <= 0) { if (x <= 0) {
throw new NotStrictlyPositiveException(in[i]); throw new NotStrictlyPositiveException(x);
} }
} }
} }
@ -567,8 +567,8 @@ public final class MathArrays {
* @since 3.4 * @since 3.4
*/ */
public static void checkNotNaN(final double[] in) { public static void checkNotNaN(final double[] in) {
for (int i = 0; i < in.length; i++) { for (double x : in) {
if (Double.isNaN(in[i])) { if (Double.isNaN(x)) {
throw new NotANumberException(); throw new NotANumberException();
} }
} }
@ -597,9 +597,9 @@ public final class MathArrays {
* @since 3.1 * @since 3.1
*/ */
public static void checkNonNegative(final long[] in) { public static void checkNonNegative(final long[] in) {
for (int i = 0; i < in.length; i++) { for (long i : in) {
if (in[i] < 0) { if (i < 0) {
throw new NotPositiveException(in[i]); throw new NotPositiveException(i);
} }
} }
} }