You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/07/21 13:15:14 UTC

[commons-lang] 02/03: Reuse getLength()

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git

commit ded8923582971e517b387bfa09414ed4c9053344
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Jul 21 09:04:18 2022 -0400

    Reuse getLength()
---
 src/main/java/org/apache/commons/lang3/ArrayUtils.java | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index c24bdb57d..741372499 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -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];