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:
Gilles Sadowski 2012-03-01 13:49:01 +00:00
parent bbbcf71511
commit 9d8f2c0506
1 changed files with 4 additions and 4 deletions

View File

@ -160,17 +160,17 @@ public class MathArrays {
boolean strict) {
Comparable previous = val[0];
final int max = val.length;
int comp;
for (int i = 1; i < max; i++) {
final int comp;
switch (dir) {
case INCREASING:
comp = -val[i].compareTo(previous);
comp = previous.compareTo(val[i]);
if (strict) {
if (0 <= comp) {
if (comp >= 0) {
return false;
}
} else {
if ( comp > 0) {
if (comp > 0) {
return false;
}
}