This is an automated email from the ASF dual-hosted git repository.
ggregory 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 d71b8c9 Use isEmpty().
d71b8c9 is described below
commit d71b8c93d20187da61113990f44cb16345cf72cb
Author: Gary Gregory <[email protected]>
AuthorDate: Sun Jan 17 09:30:17 2021 -0500
Use isEmpty().
Don't nest else clauses needlessly.
---
.../commons/math4/linear/RealMatrixFormat.java | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git
a/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
b/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
index ff025f8..51ccdc5 100644
--- a/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
+++ b/src/main/java/org/apache/commons/math4/linear/RealMatrixFormat.java
@@ -322,23 +322,21 @@ public class RealMatrixFormat {
if (!rowComponents.isEmpty()) {
CompositeFormat.parseAndIgnoreWhitespace(source, pos);
if (!CompositeFormat.parseFixedstring(source,
trimmedColumnSeparator, pos)) {
- if (trimmedRowSuffix.length() != 0 &&
+ if (!trimmedRowSuffix.isEmpty() &&
!CompositeFormat.parseFixedstring(source,
trimmedRowSuffix, pos)) {
return null;
- } else {
- CompositeFormat.parseAndIgnoreWhitespace(source, pos);
- if (CompositeFormat.parseFixedstring(source,
trimmedRowSeparator, pos)) {
- matrix.add(rowComponents);
- rowComponents = new ArrayList<>();
- continue;
- } else {
- loop = false;
- }
}
+ CompositeFormat.parseAndIgnoreWhitespace(source, pos);
+ if (CompositeFormat.parseFixedstring(source,
trimmedRowSeparator, pos)) {
+ matrix.add(rowComponents);
+ rowComponents = new ArrayList<>();
+ continue;
+ }
+ loop = false;
}
} else {
CompositeFormat.parseAndIgnoreWhitespace(source, pos);
- if (trimmedRowPrefix.length() != 0 &&
+ if (!trimmedRowPrefix.isEmpty() &&
!CompositeFormat.parseFixedstring(source,
trimmedRowPrefix, pos)) {
return null;
}