According to "FindBugs", negating the result of "compareTo" is bad
practice: Fixed. git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1295559 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
bbbcf71511
commit
9d8f2c0506
|
@ -160,17 +160,17 @@ public class MathArrays {
|
||||||
boolean strict) {
|
boolean strict) {
|
||||||
Comparable previous = val[0];
|
Comparable previous = val[0];
|
||||||
final int max = val.length;
|
final int max = val.length;
|
||||||
int comp;
|
|
||||||
for (int i = 1; i < max; i++) {
|
for (int i = 1; i < max; i++) {
|
||||||
|
final int comp;
|
||||||
switch (dir) {
|
switch (dir) {
|
||||||
case INCREASING:
|
case INCREASING:
|
||||||
comp = -val[i].compareTo(previous);
|
comp = previous.compareTo(val[i]);
|
||||||
if (strict) {
|
if (strict) {
|
||||||
if (0 <= comp) {
|
if (comp >= 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ( comp > 0) {
|
if (comp > 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue