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


The following commit(s) were added to refs/heads/master by this push:
     new 8a10229b8 Make ArrayUtils methods impl consistent with other overloads 
(#1568)
8a10229b8 is described below

commit 8a10229b89975fcf81c231b0c8313062e43a6d68
Author: David Du <[email protected]>
AuthorDate: Fri Jan 16 19:06:08 2026 +0800

    Make ArrayUtils methods impl consistent with other overloads (#1568)
---
 src/main/java/org/apache/commons/lang3/ArrayUtils.java | 17 ++++++++---------
 1 file changed, 8 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 c63bd365b..1ce0247ef 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -2435,7 +2435,7 @@ public static int indexOf(final byte[] array, final byte 
valueToFind) {
      * @return the index of the value within the array, {@link 
#INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input.
      */
     public static int indexOf(final byte[] array, final byte valueToFind, 
final int startIndex) {
-        if (array == null) {
+        if (isEmpty(array)) {
             return INDEX_NOT_FOUND;
         }
         for (int i = max0(startIndex); i < array.length; i++) {
@@ -2477,7 +2477,7 @@ public static int indexOf(final char[] array, final char 
valueToFind) {
      * @since 2.1
      */
     public static int indexOf(final char[] array, final char valueToFind, 
final int startIndex) {
-        if (array == null) {
+        if (isEmpty(array)) {
             return INDEX_NOT_FOUND;
         }
         for (int i = max0(startIndex); i < array.length; i++) {
@@ -2647,7 +2647,7 @@ public static int indexOf(final int[] array, final int 
valueToFind) {
      * @return the index of the value within the array, {@link 
#INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input.
      */
     public static int indexOf(final int[] array, final int valueToFind, final 
int startIndex) {
-        if (array == null) {
+        if (isEmpty(array)) {
             return INDEX_NOT_FOUND;
         }
         for (int i = max0(startIndex); i < array.length; i++) {
@@ -2687,7 +2687,7 @@ public static int indexOf(final long[] array, final long 
valueToFind) {
      * @return the index of the value within the array, {@link 
#INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input.
      */
     public static int indexOf(final long[] array, final long valueToFind, 
final int startIndex) {
-        if (array == null) {
+        if (isEmpty(array)) {
             return INDEX_NOT_FOUND;
         }
         for (int i = max0(startIndex); i < array.length; i++) {
@@ -2727,7 +2727,7 @@ public static int indexOf(final Object[] array, final 
Object objectToFind) {
      * @return the index of the object within the array starting at the index, 
{@link #INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input.
      */
     public static int indexOf(final Object[] array, final Object objectToFind, 
int startIndex) {
-        if (array == null) {
+        if (isEmpty(array)) {
             return INDEX_NOT_FOUND;
         }
         startIndex = max0(startIndex);
@@ -2776,7 +2776,7 @@ public static int indexOf(final short[] array, final 
short valueToFind) {
      * @return the index of the value within the array, {@link 
#INDEX_NOT_FOUND} ({@code -1}) if not found or {@code null} array input.
      */
     public static int indexOf(final short[] array, final short valueToFind, 
final int startIndex) {
-        if (array == null) {
+        if (isEmpty(array)) {
             return INDEX_NOT_FOUND;
         }
         for (int i = max0(startIndex); i < array.length; i++) {
@@ -6349,10 +6349,9 @@ public static <T> T[] removeElements(final T[] array, 
final T... values) {
      * @param array  the array to reverse, may be {@code null}.
      */
     public static void reverse(final boolean[] array) {
-        if (array == null) {
-            return;
+        if (array != null) {
+            reverse(array, 0, array.length);
         }
-        reverse(array, 0, array.length);
     }
 
     /**

Reply via email to