Skip to content

Commit a1ea0e4

Browse files
committed
Deprecate NumberUtils.compare(byte, byte) in favor of Byte.compare(byte,
byte)
1 parent 1eb7802 commit a1ea0e4

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ The <action> type attribute can be add,update,fix,remove.
6161
<action issue="LANG-1720" type="fix" dev="ggregory" due-to="Sheung Chi Chan, Arthur Chan, Gary Gregory, Elliotte Rusty Harold">Improve Javadocs for Conversion.</action>
6262
<action type="fix" dev="ggregory" due-to="mayuming">Fix CalendarUtils.toLocalDate() Javadoc return type description #1440.</action>
6363
<action type="fix" dev="ggregory" due-to="mayuming">Fix the method name in Javadoc examples for CharUtils.isHex() #1444.</action>
64+
<action type="fix" dev="ggregory" due-to="Gary Gregory">Deprecate NumberUtils.compare(byte, byte) in favor of Byte.compare(byte, byte).</action>
6465
<!-- FIX Javadoc -->
6566
<action type="fix" dev="ggregory" due-to="Gary Gregory">[javadoc] General improvements.</action>
6667
<action type="fix" dev="ggregory" due-to="Gary Gregory">[javadoc] Fix thrown exception documentation for org.apache.commons.lang3.reflect.MethodUtils.getMethodObject(Class&lt;?&gt;, String, Class&lt;?&gt;...).</action>

src/main/java/org/apache/commons/lang3/ArrayUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3622,7 +3622,7 @@ public static boolean isSorted(final byte[] array) {
36223622
final int n = array.length;
36233623
for (int i = 1; i < n; i++) {
36243624
final byte current = array[i];
3625-
if (NumberUtils.compare(previous, current) > 0) {
3625+
if (Byte.compare(previous, current) > 0) {
36263626
return false;
36273627
}
36283628
previous = current;

src/main/java/org/apache/commons/lang3/math/NumberUtils.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,11 @@ public class NumberUtils {
9595
* a value less than {@code 0} if {@code x < y}; and
9696
* a value greater than {@code 0} if {@code x > y}
9797
* @since 3.4
98+
* @deprecated Use {@link Byte#compare(byte, byte)}.
9899
*/
100+
@Deprecated
99101
public static int compare(final byte x, final byte y) {
100-
return x - y;
102+
return Byte.compare(x, y);
101103
}
102104

103105
/**

src/main/java/org/apache/commons/lang3/mutable/MutableByte.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
*/
1717
package org.apache.commons.lang3.mutable;
1818

19-
import org.apache.commons.lang3.math.NumberUtils;
20-
2119
/**
2220
* A mutable {@code byte} wrapper.
2321
* <p>
@@ -142,7 +140,7 @@ public byte byteValue() {
142140
*/
143141
@Override
144142
public int compareTo(final MutableByte other) {
145-
return NumberUtils.compare(this.value, other.value);
143+
return Byte.compare(this.value, other.value);
146144
}
147145

148146
/**

0 commit comments

Comments
 (0)