Use isEmpty().

Don't nest else clauses needlessly.
This commit is contained in:
Gary Gregory 2021-01-17 09:30:17 -05:00
parent 57a9a5c14b
commit d71b8c93d2
1 changed files with 9 additions and 11 deletions

View File

@ -322,23 +322,21 @@ public class RealMatrixFormat {
if (!rowComponents.isEmpty()) { if (!rowComponents.isEmpty()) {
CompositeFormat.parseAndIgnoreWhitespace(source, pos); CompositeFormat.parseAndIgnoreWhitespace(source, pos);
if (!CompositeFormat.parseFixedstring(source, trimmedColumnSeparator, pos)) { if (!CompositeFormat.parseFixedstring(source, trimmedColumnSeparator, pos)) {
if (trimmedRowSuffix.length() != 0 && if (!trimmedRowSuffix.isEmpty() &&
!CompositeFormat.parseFixedstring(source, trimmedRowSuffix, pos)) { !CompositeFormat.parseFixedstring(source, trimmedRowSuffix, pos)) {
return null; 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 { } else {
CompositeFormat.parseAndIgnoreWhitespace(source, pos); CompositeFormat.parseAndIgnoreWhitespace(source, pos);
if (trimmedRowPrefix.length() != 0 && if (!trimmedRowPrefix.isEmpty() &&
!CompositeFormat.parseFixedstring(source, trimmedRowPrefix, pos)) { !CompositeFormat.parseFixedstring(source, trimmedRowPrefix, pos)) {
return null; return null;
} }