PMD: Useless parentheses.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1669791 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benedikt Ritter 2015-03-28 15:22:59 +00:00
parent bb01292edd
commit dfaa656f02
7 changed files with 17 additions and 14 deletions

View File

@ -19,6 +19,8 @@
import java.io.Serializable;
import org.apache.commons.lang3.BooleanUtils;
/**
* A mutable <code>boolean</code> wrapper.
* <p>
@ -196,8 +198,7 @@ public int hashCode() {
*/
@Override
public int compareTo(final MutableBoolean other) {
final boolean anotherVal = other.value;
return value == anotherVal ? 0 : (value ? 1 : -1);
return BooleanUtils.compare(this.value, other.value);
}
//-----------------------------------------------------------------------

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.lang3.mutable;
import org.apache.commons.lang3.math.NumberUtils;
/**
* A mutable <code>byte</code> wrapper.
* <p>
@ -268,8 +270,7 @@ public int hashCode() {
*/
@Override
public int compareTo(final MutableByte other) {
final byte anotherVal = other.value;
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
return NumberUtils.compare(this.value, other.value);
}
//-----------------------------------------------------------------------

View File

@ -297,8 +297,7 @@ public int hashCode() {
*/
@Override
public int compareTo(final MutableDouble other) {
final double anotherVal = other.value;
return Double.compare(value, anotherVal);
return Double.compare(this.value, other.value);
}
//-----------------------------------------------------------------------

View File

@ -298,8 +298,7 @@ public int hashCode() {
*/
@Override
public int compareTo(final MutableFloat other) {
final float anotherVal = other.value;
return Float.compare(value, anotherVal);
return Float.compare(this.value, other.value);
}
//-----------------------------------------------------------------------

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.lang3.mutable;
import org.apache.commons.lang3.math.NumberUtils;
/**
* A mutable <code>int</code> wrapper.
* <p>
@ -258,8 +260,7 @@ public int hashCode() {
*/
@Override
public int compareTo(final MutableInt other) {
final int anotherVal = other.value;
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
return NumberUtils.compare(this.value, other.value);
}
//-----------------------------------------------------------------------

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.lang3.mutable;
import org.apache.commons.lang3.math.NumberUtils;
/**
* A mutable <code>long</code> wrapper.
* <p>
@ -258,8 +260,7 @@ public int hashCode() {
*/
@Override
public int compareTo(final MutableLong other) {
final long anotherVal = other.value;
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
return NumberUtils.compare(this.value, other.value);
}
//-----------------------------------------------------------------------

View File

@ -16,6 +16,8 @@
*/
package org.apache.commons.lang3.mutable;
import org.apache.commons.lang3.math.NumberUtils;
/**
* A mutable <code>short</code> wrapper.
* <p>
@ -268,8 +270,7 @@ public int hashCode() {
*/
@Override
public int compareTo(final MutableShort other) {
final short anotherVal = other.value;
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
return NumberUtils.compare(this.value, other.value);
}
//-----------------------------------------------------------------------