LANG-1819: Fix ArrayUtils.removeAll() Javadoc for null array input (#1614)
* updated the javadoc for Arrayutils.removeAll to match the implementation which returns null in case of null input
* fixed the grammar
* fixed the grammar
diff --git a/src/main/java/org/apache/commons/lang3/ArrayUtils.java b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
index 1faa21e..1288394 100644
--- a/src/main/java/org/apache/commons/lang3/ArrayUtils.java
+++ b/src/main/java/org/apache/commons/lang3/ArrayUtils.java
@@ -5276,7 +5276,7 @@ private static Object remove(final Object array, final int index) {
* array is always the same as that of the input array.
* </p>
* <p>
- * If the input array is {@code null}, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.
+ * If the input array is {@code null}, {@code null} will be returned.
* </p>
*
* <pre>
@@ -5286,8 +5286,8 @@ private static Object remove(final Object array, final int index) {
*
* @param array the array to remove the element from, may not be {@code null}.
* @param indices the positions of the elements to be removed.
- * @return A new array containing the existing elements except those at the specified positions.
- * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length), or if the array is {@code null}.
+ * @return A new array containing the existing elements except those at the specified positions or {@code null} if the input array is {@code null}.
+ * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length).
* @since 3.0.1
*/
public static boolean[] removeAll(final boolean[] array, final int... indices) {
@@ -5301,7 +5301,7 @@ private static Object remove(final Object array, final int index) {
* array is always the same as that of the input array.
* </p>
* <p>
- * If the input array is {@code null}, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.
+ * If the input array is {@code null}, {@code null} will be returned.
* </p>
*
* <pre>
@@ -5315,8 +5315,8 @@ private static Object remove(final Object array, final int index) {
*
* @param array the array to remove the element from, may not be {@code null}.
* @param indices the positions of the elements to be removed.
- * @return A new array containing the existing elements except those at the specified positions.
- * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length), or if the array is {@code null}.
+ * @return A new array containing the existing elements except those at the specified positions or {@code null} if the input array is {@code null}.
+ * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length).
* @since 3.0.1
*/
public static byte[] removeAll(final byte[] array, final int... indices) {
@@ -5330,7 +5330,7 @@ private static Object remove(final Object array, final int index) {
* array is always the same as that of the input array.
* </p>
* <p>
- * If the input array is {@code null}, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.
+ * If the input array is {@code null}, {@code null} will be returned.
* </p>
*
* <pre>
@@ -5344,8 +5344,8 @@ private static Object remove(final Object array, final int index) {
*
* @param array the array to remove the element from, may not be {@code null}.
* @param indices the positions of the elements to be removed.
- * @return A new array containing the existing elements except those at the specified positions.
- * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length), or if the array is {@code null}.
+ * @return A new array containing the existing elements except those at the specified positions or {@code null} if the input array is {@code null}.
+ * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length).
* @since 3.0.1
*/
public static char[] removeAll(final char[] array, final int... indices) {
@@ -5359,7 +5359,7 @@ private static Object remove(final Object array, final int index) {
* array is always the same as that of the input array.
* </p>
* <p>
- * If the input array is {@code null}, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.
+ * If the input array is {@code null}, {@code null} will be returned.
* </p>
*
* <pre>
@@ -5373,8 +5373,8 @@ private static Object remove(final Object array, final int index) {
*
* @param array the array to remove the element from, may not be {@code null}.
* @param indices the positions of the elements to be removed.
- * @return A new array containing the existing elements except those at the specified positions.
- * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length), or if the array is {@code null}.
+ * @return A new array containing the existing elements except those at the specified positions or {@code null} if the input array is {@code null}.
+ * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length).
* @since 3.0.1
*/
public static double[] removeAll(final double[] array, final int... indices) {
@@ -5388,7 +5388,7 @@ private static Object remove(final Object array, final int index) {
* array is always the same as that of the input array.
* </p>
* <p>
- * If the input array is {@code null}, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.
+ * If the input array is {@code null}, {@code null} will be returned.
* </p>
*
* <pre>
@@ -5402,8 +5402,8 @@ private static Object remove(final Object array, final int index) {
*
* @param array the array to remove the element from, may not be {@code null}.
* @param indices the positions of the elements to be removed.
- * @return A new array containing the existing elements except those at the specified positions.
- * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length), or if the array is {@code null}.
+ * @return A new array containing the existing elements except those at the specified positions or {@code null} if the input array is {@code null}.
+ * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length).
* @since 3.0.1
*/
public static float[] removeAll(final float[] array, final int... indices) {
@@ -5417,7 +5417,7 @@ private static Object remove(final Object array, final int index) {
* array is always the same as that of the input array.
* </p>
* <p>
- * If the input array is {@code null}, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.
+ * If the input array is {@code null}, {@code null} will be returned.
* </p>
*
* <pre>
@@ -5431,8 +5431,8 @@ private static Object remove(final Object array, final int index) {
*
* @param array the array to remove the element from, may not be {@code null}.
* @param indices the positions of the elements to be removed.
- * @return A new array containing the existing elements except those at the specified positions.
- * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length), or if the array is {@code null}.
+ * @return A new array containing the existing elements except those at the specified positions or {@code null} if the input array is {@code null}.
+ * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length).
* @since 3.0.1
*/
public static int[] removeAll(final int[] array, final int... indices) {
@@ -5446,7 +5446,7 @@ private static Object remove(final Object array, final int index) {
* array is always the same as that of the input array.
* </p>
* <p>
- * If the input array is {@code null}, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.
+ * If the input array is {@code null}, {@code null} will be returned.
* </p>
*
* <pre>
@@ -5460,8 +5460,8 @@ private static Object remove(final Object array, final int index) {
*
* @param array the array to remove the element from, may not be {@code null}.
* @param indices the positions of the elements to be removed.
- * @return A new array containing the existing elements except those at the specified positions.
- * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length), or if the array is {@code null}.
+ * @return A new array containing the existing elements except those at the specified positions or {@code null} if the input array is {@code null}.
+ * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length).
* @since 3.0.1
*/
public static long[] removeAll(final long[] array, final int... indices) {
@@ -5528,7 +5528,7 @@ static Object removeAll(final Object array, final int... indices) {
* array is always the same as that of the input array.
* </p>
* <p>
- * If the input array is {@code null}, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.
+ * If the input array is {@code null}, {@code null} will be returned.
* </p>
*
* <pre>
@@ -5542,8 +5542,8 @@ static Object removeAll(final Object array, final int... indices) {
*
* @param array the array to remove the element from, may not be {@code null}.
* @param indices the positions of the elements to be removed.
- * @return A new array containing the existing elements except those at the specified positions.
- * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length), or if the array is {@code null}.
+ * @return A new array containing the existing elements except those at the specified positions or {@code null} if the input array is {@code null}.
+ * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length).
* @since 3.0.1
*/
public static short[] removeAll(final short[] array, final int... indices) {
@@ -5557,7 +5557,7 @@ static Object removeAll(final Object array, final int... indices) {
* array is always the same as that of the input array.
* </p>
* <p>
- * If the input array is {@code null}, an IndexOutOfBoundsException will be thrown, because in that case no valid index can be specified.
+ * If the input array is {@code null}, {@code null} will be returned.
* </p>
*
* <pre>
@@ -5568,8 +5568,8 @@ static Object removeAll(final Object array, final int... indices) {
* @param <T> the component type of the array.
* @param array the array to remove the element from, may not be {@code null}.
* @param indices the positions of the elements to be removed.
- * @return A new array containing the existing elements except those at the specified positions.
- * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length), or if the array is {@code null}.
+ * @return A new array containing the existing elements except those at the specified positions or {@code null} if the input array is {@code null}.
+ * @throws IndexOutOfBoundsException if any index is out of range (index < 0 || index >= array.length).
* @since 3.0.1
*/
@SuppressWarnings("unchecked") // removeAll() always creates an array of the same type as its input