本文整理了Java中org.apache.commons.lang3.math.NumberUtils.compare()
方法的一些代码示例,展示了NumberUtils.compare()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NumberUtils.compare()
方法的具体详情如下:
包路径:org.apache.commons.lang3.math.NumberUtils
类名称:NumberUtils
方法名:compare
[英]Compares two byte values numerically. This is the same functionality as provided in Java 7.
[中]比较两个字节的数值。这与Java 7中提供的功能相同。
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableLong other) {
return NumberUtils.compare(this.value, other.value);
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableInt other) {
return NumberUtils.compare(this.value, other.value);
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableByte other) {
return NumberUtils.compare(this.value, other.value);
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableShort other) {
return NumberUtils.compare(this.value, other.value);
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* <p>This method checks whether the provided array is sorted according to natural ordering.
*
* @param array the array to check
* @return whether the array is sorted according to natural ordering
* @since 3.4
*/
public static boolean isSorted(final int[] array) {
if (array == null || array.length < 2) {
return true;
}
int previous = array[0];
final int n = array.length;
for (int i = 1; i < n; i++) {
final int current = array[i];
if (NumberUtils.compare(previous, current) > 0) {
return false;
}
previous = current;
}
return true;
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* <p>This method checks whether the provided array is sorted according to natural ordering.
*
* @param array the array to check
* @return whether the array is sorted according to natural ordering
* @since 3.4
*/
public static boolean isSorted(final long[] array) {
if (array == null || array.length < 2) {
return true;
}
long previous = array[0];
final int n = array.length;
for (int i = 1; i < n; i++) {
final long current = array[i];
if (NumberUtils.compare(previous, current) > 0) {
return false;
}
previous = current;
}
return true;
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* <p>This method checks whether the provided array is sorted according to natural ordering.
*
* @param array the array to check
* @return whether the array is sorted according to natural ordering
* @since 3.4
*/
public static boolean isSorted(final short[] array) {
if (array == null || array.length < 2) {
return true;
}
short previous = array[0];
final int n = array.length;
for (int i = 1; i < n; i++) {
final short current = array[i];
if (NumberUtils.compare(previous, current) > 0) {
return false;
}
previous = current;
}
return true;
}
代码示例来源:origin: org.apache.commons/commons-lang3
/**
* <p>This method checks whether the provided array is sorted according to natural ordering.
*
* @param array the array to check
* @return whether the array is sorted according to natural ordering
* @since 3.4
*/
public static boolean isSorted(final byte[] array) {
if (array == null || array.length < 2) {
return true;
}
byte previous = array[0];
final int n = array.length;
for (int i = 1; i < n; i++) {
final byte current = array[i];
if (NumberUtils.compare(previous, current) > 0) {
return false;
}
previous = current;
}
return true;
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void compareByte() {
assertTrue(NumberUtils.compare((byte)-3, (byte)0) < 0);
assertTrue(NumberUtils.compare((byte)113, (byte)113)==0);
assertTrue(NumberUtils.compare((byte)123, (byte)32) > 0);
}
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void compareShort() {
assertTrue(NumberUtils.compare((short)-3, (short)0) < 0);
assertTrue(NumberUtils.compare((short)113, (short)113)==0);
assertTrue(NumberUtils.compare((short)213, (short)32) > 0);
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void compareLong() {
assertTrue(NumberUtils.compare(-3L, 0L) < 0);
assertTrue(NumberUtils.compare(113L, 113L)==0);
assertTrue(NumberUtils.compare(213L, 32L) > 0);
}
代码示例来源:origin: org.apache.commons/commons-lang3
@Test
public void compareInt() {
assertTrue(NumberUtils.compare(-3, 0) < 0);
assertTrue(NumberUtils.compare(113, 113)==0);
assertTrue(NumberUtils.compare(213, 32) > 0);
}
代码示例来源:origin: io.virtdata/virtdata-lib-curves4
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableLong other) {
return NumberUtils.compare(this.value, other.value);
}
代码示例来源:origin: io.virtdata/virtdata-lib-curves4
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableInt other) {
return NumberUtils.compare(this.value, other.value);
}
代码示例来源:origin: io.virtdata/virtdata-lib-curves4
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableByte other) {
return NumberUtils.compare(this.value, other.value);
}
代码示例来源:origin: io.virtdata/virtdata-lib-curves4
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableShort other) {
return NumberUtils.compare(this.value, other.value);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableByte other) {
return NumberUtils.compare(this.value, other.value);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableLong other) {
return NumberUtils.compare(this.value, other.value);
}
代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableByte other) {
return NumberUtils.compare(this.value, other.value);
}
代码示例来源:origin: io.virtdata/virtdata-lib-realer
/**
* Compares this mutable to another in ascending order.
*
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
@Override
public int compareTo(final MutableShort other) {
return NumberUtils.compare(this.value, other.value);
}
内容来源于网络,如有侵权,请联系作者删除!