Reuse getLength()

This commit is contained in:
Gary Gregory 2022-07-21 09:04:18 -04:00
parent 552fead535
commit ded8923582
1 changed files with 9 additions and 9 deletions

View File

@ -3550,7 +3550,7 @@ public class ArrayUtils {
* @since 3.4
*/
public static boolean isSorted(final boolean[] array) {
if (array == null || array.length < 2) {
if (getLength(array) < 2) {
return true;
}
@ -3575,7 +3575,7 @@ public class ArrayUtils {
* @since 3.4
*/
public static boolean isSorted(final byte[] array) {
if (array == null || array.length < 2) {
if (getLength(array) < 2) {
return true;
}
@ -3600,7 +3600,7 @@ public class ArrayUtils {
* @since 3.4
*/
public static boolean isSorted(final char[] array) {
if (array == null || array.length < 2) {
if (getLength(array) < 2) {
return true;
}
@ -3625,7 +3625,7 @@ public class ArrayUtils {
* @since 3.4
*/
public static boolean isSorted(final double[] array) {
if (array == null || array.length < 2) {
if (getLength(array) < 2) {
return true;
}
@ -3650,7 +3650,7 @@ public class ArrayUtils {
* @since 3.4
*/
public static boolean isSorted(final float[] array) {
if (array == null || array.length < 2) {
if (getLength(array) < 2) {
return true;
}
@ -3675,7 +3675,7 @@ public class ArrayUtils {
* @since 3.4
*/
public static boolean isSorted(final int[] array) {
if (array == null || array.length < 2) {
if (getLength(array) < 2) {
return true;
}
@ -3700,7 +3700,7 @@ public class ArrayUtils {
* @since 3.4
*/
public static boolean isSorted(final long[] array) {
if (array == null || array.length < 2) {
if (getLength(array) < 2) {
return true;
}
@ -3725,7 +3725,7 @@ public class ArrayUtils {
* @since 3.4
*/
public static boolean isSorted(final short[] array) {
if (array == null || array.length < 2) {
if (getLength(array) < 2) {
return true;
}
@ -3766,7 +3766,7 @@ public class ArrayUtils {
*/
public static <T> boolean isSorted(final T[] array, final Comparator<T> comparator) {
Objects.requireNonNull(comparator, "comparator");
if (array == null || array.length < 2) {
if (getLength(array) < 2) {
return true;
}
T previous = array[0];