You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2023/01/06 02:49:51 UTC
[commons-math] branch master updated: Use "forEach" syntax.
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git
The following commit(s) were added to refs/heads/master by this push:
new b05b58d2f Use "forEach" syntax.
b05b58d2f is described below
commit b05b58d2fd0225f013fa07b1444aae4752744ee4
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Fri Jan 6 03:49:01 2023 +0100
Use "forEach" syntax.
---
.../org/apache/commons/math4/legacy/core/MathArrays.java | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/commons-math-legacy-core/src/main/java/org/apache/commons/math4/legacy/core/MathArrays.java b/commons-math-legacy-core/src/main/java/org/apache/commons/math4/legacy/core/MathArrays.java
index a208686de..cd83c7f5d 100644
--- a/commons-math-legacy-core/src/main/java/org/apache/commons/math4/legacy/core/MathArrays.java
+++ b/commons-math-legacy-core/src/main/java/org/apache/commons/math4/legacy/core/MathArrays.java
@@ -552,9 +552,9 @@ public final class MathArrays {
* @since 3.1
*/
public static void checkPositive(final double[] in) {
- for (int i = 0; i < in.length; i++) {
- if (in[i] <= 0) {
- throw new NotStrictlyPositiveException(in[i]);
+ for (double x : in) {
+ if (x <= 0) {
+ throw new NotStrictlyPositiveException(x);
}
}
}
@@ -567,8 +567,8 @@ public final class MathArrays {
* @since 3.4
*/
public static void checkNotNaN(final double[] in) {
- for (int i = 0; i < in.length; i++) {
- if (Double.isNaN(in[i])) {
+ for (double x : in) {
+ if (Double.isNaN(x)) {
throw new NotANumberException();
}
}
@@ -597,9 +597,9 @@ public final class MathArrays {
* @since 3.1
*/
public static void checkNonNegative(final long[] in) {
- for (int i = 0; i < in.length; i++) {
- if (in[i] < 0) {
- throw new NotPositiveException(in[i]);
+ for (long i : in) {
+ if (i < 0) {
+ throw new NotPositiveException(i);
}
}
}