diff --git a/src/java/org/apache/commons/lang/ArrayUtils.java b/src/java/org/apache/commons/lang/ArrayUtils.java
index b2213a3b4..fe58348f5 100644
--- a/src/java/org/apache/commons/lang/ArrayUtils.java
+++ b/src/java/org/apache/commons/lang/ArrayUtils.java
@@ -125,6 +125,13 @@ public class ArrayUtils {
*/
public static final Character[] EMPTY_CHARACTER_OBJECT_ARRAY = new Character[0];
+ /**
+ * The index value when an element is not found in a list or array: -1
.
+ * This value is returned by methods in this class and can also be used in comparisons with values returned by
+ * various method from {@link java.util.List}.
+ */
+ public static final int INDEX_NOT_FOUND = -1;
+
/**
*
ArrayUtils instances should NOT be constructed in standard programming.
* Instead, the class should be used as ArrayUtils.clone(new int[] {2})
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
null
@@ -261,7 +268,7 @@ public static Map toMap(Object[] array) {
* The objects in the array are not cloned, thus there is no special * handling for multi-dimensional arrays.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
null
* @return the cloned array, null
if null
input
@@ -277,7 +284,7 @@ public static Object[] clone(Object[] array) {
* Clones an array returning a typecast result and handling
* null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
null
* @return the cloned array, null
if null
input
@@ -293,7 +300,7 @@ public static long[] clone(long[] array) {
* Clones an array returning a typecast result and handling
* null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
null
* @return the cloned array, null
if null
input
@@ -309,7 +316,7 @@ public static int[] clone(int[] array) {
* Clones an array returning a typecast result and handling
* null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
null
* @return the cloned array, null
if null
input
@@ -325,7 +332,7 @@ public static short[] clone(short[] array) {
* Clones an array returning a typecast result and handling
* null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
null
* @return the cloned array, null
if null
input
@@ -341,7 +348,7 @@ public static char[] clone(char[] array) {
* Clones an array returning a typecast result and handling
* null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
null
* @return the cloned array, null
if null
input
@@ -357,7 +364,7 @@ public static byte[] clone(byte[] array) {
* Clones an array returning a typecast result and handling
* null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
null
* @return the cloned array, null
if null
input
@@ -373,7 +380,7 @@ public static double[] clone(double[] array) {
* Clones an array returning a typecast result and handling
* null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
null
* @return the cloned array, null
if null
input
@@ -389,7 +396,7 @@ public static float[] clone(float[] array) {
* Clones an array returning a typecast result and handling
* null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
null
* @return the cloned array, null
if null
input
@@ -979,7 +986,7 @@ public static boolean isSameType(Object array1, Object array2) {
*
* There is no special handling for multi-dimensional arrays.
* - *This method does nothing if null
array input.
This method does nothing for a null
input array.
null
*/
@@ -1002,7 +1009,7 @@ public static void reverse(Object[] array) {
/**
* Reverses the order of the given array.
* - *This method does nothing if null
array input.
This method does nothing for a null
input array.
null
*/
@@ -1025,7 +1032,7 @@ public static void reverse(long[] array) {
/**
* Reverses the order of the given array.
* - *This method does nothing if null
array input.
This method does nothing for a null
input array.
null
*/
@@ -1048,7 +1055,7 @@ public static void reverse(int[] array) {
/**
* Reverses the order of the given array.
* - *This method does nothing if null
array input.
This method does nothing for a null
input array.
null
*/
@@ -1071,7 +1078,7 @@ public static void reverse(short[] array) {
/**
* Reverses the order of the given array.
* - *This method does nothing if null
array input.
This method does nothing for a null
input array.
null
*/
@@ -1094,7 +1101,7 @@ public static void reverse(char[] array) {
/**
* Reverses the order of the given array.
* - *This method does nothing if null
array input.
This method does nothing for a null
input array.
null
*/
@@ -1117,7 +1124,7 @@ public static void reverse(byte[] array) {
/**
* Reverses the order of the given array.
* - *This method does nothing if null
array input.
This method does nothing for a null
input array.
null
*/
@@ -1140,7 +1147,7 @@ public static void reverse(double[] array) {
/**
* Reverses the order of the given array.
* - *This method does nothing if null
array input.
This method does nothing for a null
input array.
null
*/
@@ -1163,7 +1170,7 @@ public static void reverse(float[] array) {
/**
* Reverses the order of the given array.
* - *This method does nothing if null
array input.
This method does nothing for a null
input array.
null
*/
@@ -1189,36 +1196,36 @@ public static void reverse(boolean[] array) {
// Object IndexOf
//-----------------------------------------------------------------------
/**
- * Find the index of the given object in the array.
+ *Finds the index of the given object in the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param objectToFind the object to find, may be null
* @return the index of the object within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(Object[] array, Object objectToFind) {
return indexOf(array, objectToFind, 0);
}
/**
- * Find the index of the given object in the array starting at the given index.
+ *Finds the index of the given object in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex is treated as zero. A startIndex larger than the array
- * length will return -1
.
-1
).
*
* @param array the array to search through for the object, may be null
* @param objectToFind the object to find, may be null
* @param startIndex the index to start searching at
* @return the index of the object within the array starting at the index,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(Object[] array, Object objectToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
startIndex = 0;
@@ -1236,43 +1243,43 @@ public static int indexOf(Object[] array, Object objectToFind, int startIndex) {
}
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
- * Find the last index of the given object within the array.
+ *Finds the last index of the given object within the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param objectToFind the object to find, may be null
* @return the last index of the object within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(Object[] array, Object objectToFind) {
return lastIndexOf(array, objectToFind, Integer.MAX_VALUE);
}
/**
- * Find the last index of the given object in the array starting at the given index.
+ *Finds the last index of the given object in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex will return -1
. A startIndex larger than
+ *
A negative startIndex will return {@link #INDEX_NOT_FOUND} (-1
). A startIndex larger than
* the array length will search from the end of the array.
null
* @param objectToFind the object to find, may be null
* @param startIndex the start index to travers backwards from
* @return the last index of the object within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(Object[] array, Object objectToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
- return -1;
+ return INDEX_NOT_FOUND;
} else if (startIndex >= array.length) {
startIndex = array.length - 1;
}
@@ -1289,7 +1296,7 @@ public static int lastIndexOf(Object[] array, Object objectToFind, int startInde
}
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
@@ -1302,42 +1309,42 @@ public static int lastIndexOf(Object[] array, Object objectToFind, int startInde
* @return true
if the array contains the object
*/
public static boolean contains(Object[] array, Object objectToFind) {
- return indexOf(array, objectToFind) != -1;
+ return indexOf(array, objectToFind) != INDEX_NOT_FOUND;
}
// long IndexOf
//-----------------------------------------------------------------------
/**
- * Find the index of the given value in the array.
+ *Finds the index of the given value in the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the value to find
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(long[] array, long valueToFind) {
return indexOf(array, valueToFind, 0);
}
/**
- * Find the index of the given value in the array starting at the given index.
+ *Finds the index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex is treated as zero. A startIndex larger than the array - * length will return -1.
+ * length will return {@link #INDEX_NOT_FOUND} (-1
).
*
* @param array the array to search through for the object, may be null
* @param valueToFind the value to find
* @param startIndex the index to start searching at
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(long[] array, long valueToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
startIndex = 0;
@@ -1347,43 +1354,43 @@ public static int indexOf(long[] array, long valueToFind, int startIndex) {
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
- * Find the last index of the given value within the array.
+ *Finds the last index of the given value within the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the object to find
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(long[] array, long valueToFind) {
return lastIndexOf(array, valueToFind, Integer.MAX_VALUE);
}
/**
- * Find the last index of the given value in the array starting at the given index.
+ *Finds the last index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex will return -1. A startIndex larger than the array - * length will search from the end of the array.
+ *A negative startIndex will return {@link #INDEX_NOT_FOUND} (-1
). A startIndex larger than the
+ * array length will search from the end of the array.
null
* @param valueToFind the value to find
* @param startIndex the start index to travers backwards from
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(long[] array, long valueToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
- return -1;
+ return INDEX_NOT_FOUND;
} else if (startIndex >= array.length) {
startIndex = array.length - 1;
}
@@ -1392,7 +1399,7 @@ public static int lastIndexOf(long[] array, long valueToFind, int startIndex) {
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
@@ -1405,42 +1412,42 @@ public static int lastIndexOf(long[] array, long valueToFind, int startIndex) {
* @return true
if the array contains the object
*/
public static boolean contains(long[] array, long valueToFind) {
- return indexOf(array, valueToFind) != -1;
+ return indexOf(array, valueToFind) != INDEX_NOT_FOUND;
}
// int IndexOf
//-----------------------------------------------------------------------
/**
- * Find the index of the given value in the array.
+ *Finds the index of the given value in the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the value to find
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(int[] array, int valueToFind) {
return indexOf(array, valueToFind, 0);
}
/**
- * Find the index of the given value in the array starting at the given index.
+ *Finds the index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex is treated as zero. A startIndex larger than the array - * length will return -1.
+ * length will return {@link #INDEX_NOT_FOUND} (-1
).
*
* @param array the array to search through for the object, may be null
* @param valueToFind the value to find
* @param startIndex the index to start searching at
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(int[] array, int valueToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
startIndex = 0;
@@ -1450,43 +1457,43 @@ public static int indexOf(int[] array, int valueToFind, int startIndex) {
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
- * Find the last index of the given value within the array.
+ *Finds the last index of the given value within the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the object to find
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(int[] array, int valueToFind) {
return lastIndexOf(array, valueToFind, Integer.MAX_VALUE);
}
/**
- * Find the last index of the given value in the array starting at the given index.
+ *Finds the last index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex will return -1. A startIndex larger than the array - * length will search from the end of the array.
+ *A negative startIndex will return {@link #INDEX_NOT_FOUND} (-1
). A startIndex larger than the
+ * array length will search from the end of the array.
null
* @param valueToFind the value to find
* @param startIndex the start index to travers backwards from
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(int[] array, int valueToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
- return -1;
+ return INDEX_NOT_FOUND;
} else if (startIndex >= array.length) {
startIndex = array.length - 1;
}
@@ -1495,7 +1502,7 @@ public static int lastIndexOf(int[] array, int valueToFind, int startIndex) {
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
@@ -1508,42 +1515,42 @@ public static int lastIndexOf(int[] array, int valueToFind, int startIndex) {
* @return true
if the array contains the object
*/
public static boolean contains(int[] array, int valueToFind) {
- return indexOf(array, valueToFind) != -1;
+ return indexOf(array, valueToFind) != INDEX_NOT_FOUND;
}
// short IndexOf
//-----------------------------------------------------------------------
/**
- * Find the index of the given value in the array.
+ *Finds the index of the given value in the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the value to find
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(short[] array, short valueToFind) {
return indexOf(array, valueToFind, 0);
}
/**
- * Find the index of the given value in the array starting at the given index.
+ *Finds the index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex is treated as zero. A startIndex larger than the array - * length will return -1.
+ * length will return {@link #INDEX_NOT_FOUND} (-1
).
*
* @param array the array to search through for the object, may be null
* @param valueToFind the value to find
* @param startIndex the index to start searching at
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(short[] array, short valueToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
startIndex = 0;
@@ -1553,43 +1560,43 @@ public static int indexOf(short[] array, short valueToFind, int startIndex) {
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
- * Find the last index of the given value within the array.
+ *Finds the last index of the given value within the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the object to find
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(short[] array, short valueToFind) {
return lastIndexOf(array, valueToFind, Integer.MAX_VALUE);
}
/**
- * Find the last index of the given value in the array starting at the given index.
+ *Finds the last index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex will return -1. A startIndex larger than the array - * length will search from the end of the array.
+ *A negative startIndex will return {@link #INDEX_NOT_FOUND} (-1
). A startIndex larger than the
+ * array length will search from the end of the array.
null
* @param valueToFind the value to find
* @param startIndex the start index to travers backwards from
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(short[] array, short valueToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
- return -1;
+ return INDEX_NOT_FOUND;
} else if (startIndex >= array.length) {
startIndex = array.length - 1;
}
@@ -1598,7 +1605,7 @@ public static int lastIndexOf(short[] array, short valueToFind, int startIndex)
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
@@ -1611,20 +1618,20 @@ public static int lastIndexOf(short[] array, short valueToFind, int startIndex)
* @return true
if the array contains the object
*/
public static boolean contains(short[] array, short valueToFind) {
- return indexOf(array, valueToFind) != -1;
+ return indexOf(array, valueToFind) != INDEX_NOT_FOUND;
}
// char IndexOf
//-----------------------------------------------------------------------
/**
- * Find the index of the given value in the array.
+ *Finds the index of the given value in the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the value to find
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
* @since 2.1
*/
public static int indexOf(char[] array, char valueToFind) {
@@ -1632,23 +1639,23 @@ public static int indexOf(char[] array, char valueToFind) {
}
/**
- * Find the index of the given value in the array starting at the given index.
+ *Finds the index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex is treated as zero. A startIndex larger than the array - * length will return -1.
+ * length will return {@link #INDEX_NOT_FOUND} (-1
).
*
* @param array the array to search through for the object, may be null
* @param valueToFind the value to find
* @param startIndex the index to start searching at
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
* @since 2.1
*/
public static int indexOf(char[] array, char valueToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
startIndex = 0;
@@ -1658,18 +1665,18 @@ public static int indexOf(char[] array, char valueToFind, int startIndex) {
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
- * Find the last index of the given value within the array.
+ *Finds the last index of the given value within the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the object to find
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
* @since 2.1
*/
public static int lastIndexOf(char[] array, char valueToFind) {
@@ -1677,26 +1684,26 @@ public static int lastIndexOf(char[] array, char valueToFind) {
}
/**
- * Find the last index of the given value in the array starting at the given index.
+ *Finds the last index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex will return -1. A startIndex larger than the array - * length will search from the end of the array.
+ *A negative startIndex will return {@link #INDEX_NOT_FOUND} (-1
). A startIndex larger than the
+ * array length will search from the end of the array.
null
* @param valueToFind the value to find
* @param startIndex the start index to travers backwards from
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
* @since 2.1
*/
public static int lastIndexOf(char[] array, char valueToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
- return -1;
+ return INDEX_NOT_FOUND;
} else if (startIndex >= array.length) {
startIndex = array.length - 1;
}
@@ -1705,7 +1712,7 @@ public static int lastIndexOf(char[] array, char valueToFind, int startIndex) {
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
@@ -1719,42 +1726,42 @@ public static int lastIndexOf(char[] array, char valueToFind, int startIndex) {
* @since 2.1
*/
public static boolean contains(char[] array, char valueToFind) {
- return indexOf(array, valueToFind) != -1;
+ return indexOf(array, valueToFind) != INDEX_NOT_FOUND;
}
// byte IndexOf
//-----------------------------------------------------------------------
/**
- * Find the index of the given value in the array.
+ *Finds the index of the given value in the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the value to find
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(byte[] array, byte valueToFind) {
return indexOf(array, valueToFind, 0);
}
/**
- * Find the index of the given value in the array starting at the given index.
+ *Finds the index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex is treated as zero. A startIndex larger than the array - * length will return -1.
+ * length will return {@link #INDEX_NOT_FOUND} (-1
).
*
* @param array the array to search through for the object, may be null
* @param valueToFind the value to find
* @param startIndex the index to start searching at
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(byte[] array, byte valueToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
startIndex = 0;
@@ -1764,43 +1771,43 @@ public static int indexOf(byte[] array, byte valueToFind, int startIndex) {
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
- * Find the last index of the given value within the array.
+ *Finds the last index of the given value within the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the object to find
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(byte[] array, byte valueToFind) {
return lastIndexOf(array, valueToFind, Integer.MAX_VALUE);
}
/**
- * Find the last index of the given value in the array starting at the given index.
+ *Finds the last index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex will return -1. A startIndex larger than the array - * length will search from the end of the array.
+ *A negative startIndex will return {@link #INDEX_NOT_FOUND} (-1
). A startIndex larger than the
+ * array length will search from the end of the array.
null
* @param valueToFind the value to find
* @param startIndex the start index to travers backwards from
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(byte[] array, byte valueToFind, int startIndex) {
if (array == null) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
- return -1;
+ return INDEX_NOT_FOUND;
} else if (startIndex >= array.length) {
startIndex = array.length - 1;
}
@@ -1809,7 +1816,7 @@ public static int lastIndexOf(byte[] array, byte valueToFind, int startIndex) {
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
@@ -1822,59 +1829,59 @@ public static int lastIndexOf(byte[] array, byte valueToFind, int startIndex) {
* @return true
if the array contains the object
*/
public static boolean contains(byte[] array, byte valueToFind) {
- return indexOf(array, valueToFind) != -1;
+ return indexOf(array, valueToFind) != INDEX_NOT_FOUND;
}
// double IndexOf
//-----------------------------------------------------------------------
/**
- * Find the index of the given value in the array.
+ *Finds the index of the given value in the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the value to find
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(double[] array, double valueToFind) {
return indexOf(array, valueToFind, 0);
}
/**
- * Find the index of the given value within a given tolerance in the array. + *
Finds the index of the given value within a given tolerance in the array. * This method will return the index of the first value which falls between the region * defined by valueToFind - tolerance and valueToFind + tolerance.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the value to find
* @param tolerance tolerance of the search
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(double[] array, double valueToFind, double tolerance) {
return indexOf(array, valueToFind, 0, tolerance);
}
/**
- * Find the index of the given value in the array starting at the given index.
+ *Finds the index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex is treated as zero. A startIndex larger than the array - * length will return -1.
+ * length will return {@link #INDEX_NOT_FOUND} (-1
).
*
* @param array the array to search through for the object, may be null
* @param valueToFind the value to find
* @param startIndex the index to start searching at
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(double[] array, double valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
startIndex = 0;
@@ -1884,29 +1891,29 @@ public static int indexOf(double[] array, double valueToFind, int startIndex) {
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
- * Find the index of the given value in the array starting at the given index. + *
Finds the index of the given value in the array starting at the given index. * This method will return the index of the first value which falls between the region * defined by valueToFind - tolerance and valueToFind + tolerance.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex is treated as zero. A startIndex larger than the array - * length will return -1.
+ * length will return {@link #INDEX_NOT_FOUND} (-1
).
*
* @param array the array to search through for the object, may be null
* @param valueToFind the value to find
* @param startIndex the index to start searching at
* @param tolerance tolerance of the search
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(double[] array, double valueToFind, int startIndex, double tolerance) {
if (ArrayUtils.isEmpty(array)) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
startIndex = 0;
@@ -1918,60 +1925,60 @@ public static int indexOf(double[] array, double valueToFind, int startIndex, do
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
- * Find the last index of the given value within the array.
+ *Finds the last index of the given value within the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the object to find
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(double[] array, double valueToFind) {
return lastIndexOf(array, valueToFind, Integer.MAX_VALUE);
}
/**
- * Find the last index of the given value within a given tolerance in the array. + *
Finds the last index of the given value within a given tolerance in the array. * This method will return the index of the last value which falls between the region * defined by valueToFind - tolerance and valueToFind + tolerance.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the value to find
* @param tolerance tolerance of the search
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(double[] array, double valueToFind, double tolerance) {
return lastIndexOf(array, valueToFind, Integer.MAX_VALUE, tolerance);
}
/**
- * Find the last index of the given value in the array starting at the given index.
+ *Finds the last index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex will return -1. A startIndex larger than the array - * length will search from the end of the array.
+ *A negative startIndex will return {@link #INDEX_NOT_FOUND} (-1
). A startIndex larger than the
+ * array length will search from the end of the array.
null
* @param valueToFind the value to find
* @param startIndex the start index to travers backwards from
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(double[] array, double valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
- return -1;
+ return INDEX_NOT_FOUND;
} else if (startIndex >= array.length) {
startIndex = array.length - 1;
}
@@ -1980,32 +1987,32 @@ public static int lastIndexOf(double[] array, double valueToFind, int startIndex
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
- * Find the last index of the given value in the array starting at the given index. + *
Finds the last index of the given value in the array starting at the given index. * This method will return the index of the last value which falls between the region * defined by valueToFind - tolerance and valueToFind + tolerance.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex will return -1. A startIndex larger than the array - * length will search from the end of the array.
+ *A negative startIndex will return {@link #INDEX_NOT_FOUND} (-1
). A startIndex larger than the
+ * array length will search from the end of the array.
null
* @param valueToFind the value to find
* @param startIndex the start index to travers backwards from
* @param tolerance search for value within plus/minus this amount
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(double[] array, double valueToFind, int startIndex, double tolerance) {
if (ArrayUtils.isEmpty(array)) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
- return -1;
+ return INDEX_NOT_FOUND;
} else if (startIndex >= array.length) {
startIndex = array.length - 1;
}
@@ -2016,7 +2023,7 @@ public static int lastIndexOf(double[] array, double valueToFind, int startIndex
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
@@ -2029,7 +2036,7 @@ public static int lastIndexOf(double[] array, double valueToFind, int startIndex
* @return true
if the array contains the object
*/
public static boolean contains(double[] array, double valueToFind) {
- return indexOf(array, valueToFind) != -1;
+ return indexOf(array, valueToFind) != INDEX_NOT_FOUND;
}
/**
@@ -2046,42 +2053,42 @@ public static boolean contains(double[] array, double valueToFind) {
* @return true if value falling within tolerance is in array
*/
public static boolean contains(double[] array, double valueToFind, double tolerance) {
- return indexOf(array, valueToFind, 0, tolerance) != -1;
+ return indexOf(array, valueToFind, 0, tolerance) != INDEX_NOT_FOUND;
}
// float IndexOf
//-----------------------------------------------------------------------
/**
- * Find the index of the given value in the array.
+ *Finds the index of the given value in the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the value to find
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(float[] array, float valueToFind) {
return indexOf(array, valueToFind, 0);
}
/**
- * Find the index of the given value in the array starting at the given index.
+ *Finds the index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex is treated as zero. A startIndex larger than the array - * length will return -1.
+ * length will return {@link #INDEX_NOT_FOUND} (-1
).
*
* @param array the array to search through for the object, may be null
* @param valueToFind the value to find
* @param startIndex the index to start searching at
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(float[] array, float valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
startIndex = 0;
@@ -2091,43 +2098,43 @@ public static int indexOf(float[] array, float valueToFind, int startIndex) {
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
- * Find the last index of the given value within the array.
+ *Finds the last index of the given value within the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the object to find
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(float[] array, float valueToFind) {
return lastIndexOf(array, valueToFind, Integer.MAX_VALUE);
}
/**
- * Find the last index of the given value in the array starting at the given index.
+ *Finds the last index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex will return -1. A startIndex larger than the array - * length will search from the end of the array.
+ *A negative startIndex will return {@link #INDEX_NOT_FOUND} (-1
). A startIndex larger than the
+ * array length will search from the end of the array.
null
* @param valueToFind the value to find
* @param startIndex the start index to travers backwards from
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(float[] array, float valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
- return -1;
+ return INDEX_NOT_FOUND;
} else if (startIndex >= array.length) {
startIndex = array.length - 1;
}
@@ -2136,7 +2143,7 @@ public static int lastIndexOf(float[] array, float valueToFind, int startIndex)
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
@@ -2149,42 +2156,43 @@ public static int lastIndexOf(float[] array, float valueToFind, int startIndex)
* @return true
if the array contains the object
*/
public static boolean contains(float[] array, float valueToFind) {
- return indexOf(array, valueToFind) != -1;
+ return indexOf(array, valueToFind) != INDEX_NOT_FOUND;
}
// boolean IndexOf
//-----------------------------------------------------------------------
/**
- * Find the index of the given value in the array.
+ *Finds the index of the given value in the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
null
* @param valueToFind the value to find
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int indexOf(boolean[] array, boolean valueToFind) {
return indexOf(array, valueToFind, 0);
}
/**
- * Find the index of the given value in the array starting at the given index.
+ *Finds the index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex is treated as zero. A startIndex larger than the array - * length will return -1.
+ * length will return {@link #INDEX_NOT_FOUND} (-1
).
*
* @param array the array to search through for the object, may be null
* @param valueToFind the value to find
* @param startIndex the index to start searching at
* @return the index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
+ * array input
*/
public static int indexOf(boolean[] array, boolean valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
startIndex = 0;
@@ -2194,43 +2202,44 @@ public static int indexOf(boolean[] array, boolean valueToFind, int startIndex)
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
- * Find the last index of the given value within the array.
+ *Finds the last index of the given value within the array.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) if
+ * null
array input.
null
* @param valueToFind the object to find
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(boolean[] array, boolean valueToFind) {
return lastIndexOf(array, valueToFind, Integer.MAX_VALUE);
}
/**
- * Find the last index of the given value in the array starting at the given index.
+ *Finds the last index of the given value in the array starting at the given index.
* - *This method returns -1
if null
array input.
This method returns {@link #INDEX_NOT_FOUND} (-1
) for a null
input array.
A negative startIndex will return -1. A startIndex larger than the array - * length will search from the end of the array.
+ *A negative startIndex will return {@link #INDEX_NOT_FOUND} (-1
). A startIndex larger than
+ * the array length will search from the end of the array.
null
* @param valueToFind the value to find
* @param startIndex the start index to travers backwards from
* @return the last index of the value within the array,
- * -1
if not found or null
array input
+ * {@link #INDEX_NOT_FOUND} (-1
) if not found or null
array input
*/
public static int lastIndexOf(boolean[] array, boolean valueToFind, int startIndex) {
if (ArrayUtils.isEmpty(array)) {
- return -1;
+ return INDEX_NOT_FOUND;
}
if (startIndex < 0) {
- return -1;
+ return INDEX_NOT_FOUND;
} else if (startIndex >= array.length) {
startIndex = array.length - 1;
}
@@ -2239,7 +2248,7 @@ public static int lastIndexOf(boolean[] array, boolean valueToFind, int startInd
return i;
}
}
- return -1;
+ return INDEX_NOT_FOUND;
}
/**
@@ -2252,7 +2261,7 @@ public static int lastIndexOf(boolean[] array, boolean valueToFind, int startInd
* @return true
if the array contains the object
*/
public static boolean contains(boolean[] array, boolean valueToFind) {
- return indexOf(array, valueToFind) != -1;
+ return indexOf(array, valueToFind) != INDEX_NOT_FOUND;
}
// Primitive/Object array converters
@@ -2263,7 +2272,7 @@ public static boolean contains(boolean[] array, boolean valueToFind) {
/**
* Converts an array of object Longs to primitives.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
Long
array, may be null
* @return a long
array, null
if null array input
@@ -2285,7 +2294,7 @@ public static long[] toPrimitive(Long[] array) {
/**
* Converts an array of object Long to primitives handling null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
Long
array, may be null
* @param valueForNull the value to insert if null
found
@@ -2308,7 +2317,7 @@ public static long[] toPrimitive(Long[] array, long valueForNull) {
/**
* Converts an array of primitive longs to objects.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
long
array
* @return a Long
array, null
if null array input
@@ -2331,7 +2340,7 @@ public static Long[] toObject(long[] array) {
/**
* Converts an array of object Integers to primitives.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
Integer
array, may be null
* @return an int
array, null
if null array input
@@ -2353,7 +2362,7 @@ public static int[] toPrimitive(Integer[] array) {
/**
* Converts an array of object Integer to primitives handling null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
Integer
array, may be null
* @param valueForNull the value to insert if null
found
@@ -2376,7 +2385,7 @@ public static int[] toPrimitive(Integer[] array, int valueForNull) {
/**
* Converts an array of primitive ints to objects.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
int
array
* @return an Integer
array, null
if null array input
@@ -2399,7 +2408,7 @@ public static Integer[] toObject(int[] array) {
/**
* Converts an array of object Shorts to primitives.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
Short
array, may be null
* @return a byte
array, null
if null array input
@@ -2421,7 +2430,7 @@ public static short[] toPrimitive(Short[] array) {
/**
* Converts an array of object Short to primitives handling null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
Short
array, may be null
* @param valueForNull the value to insert if null
found
@@ -2444,7 +2453,7 @@ public static short[] toPrimitive(Short[] array, short valueForNull) {
/**
* Converts an array of primitive shorts to objects.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
short
array
* @return a Short
array, null
if null array input
@@ -2467,7 +2476,7 @@ public static Short[] toObject(short[] array) {
/**
* Converts an array of object Bytes to primitives.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
Byte
array, may be null
* @return a byte
array, null
if null array input
@@ -2489,7 +2498,7 @@ public static byte[] toPrimitive(Byte[] array) {
/**
* Converts an array of object Bytes to primitives handling null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
Byte
array, may be null
* @param valueForNull the value to insert if null
found
@@ -2512,7 +2521,7 @@ public static byte[] toPrimitive(Byte[] array, byte valueForNull) {
/**
* Converts an array of primitive bytes to objects.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
byte
array
* @return a Byte
array, null
if null array input
@@ -2535,7 +2544,7 @@ public static Byte[] toObject(byte[] array) {
/**
* Converts an array of object Doubles to primitives.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
Double
array, may be null
* @return a double
array, null
if null array input
@@ -2557,7 +2566,7 @@ public static double[] toPrimitive(Double[] array) {
/**
* Converts an array of object Doubles to primitives handling null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
Double
array, may be null
* @param valueForNull the value to insert if null
found
@@ -2580,7 +2589,7 @@ public static double[] toPrimitive(Double[] array, double valueForNull) {
/**
* Converts an array of primitive doubles to objects.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
double
array
* @return a Double
array, null
if null array input
@@ -2603,7 +2612,7 @@ public static Double[] toObject(double[] array) {
/**
* Converts an array of object Floats to primitives.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
Float
array, may be null
* @return a float
array, null
if null array input
@@ -2625,7 +2634,7 @@ public static float[] toPrimitive(Float[] array) {
/**
* Converts an array of object Floats to primitives handling null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
Float
array, may be null
* @param valueForNull the value to insert if null
found
@@ -2648,7 +2657,7 @@ public static float[] toPrimitive(Float[] array, float valueForNull) {
/**
* Converts an array of primitive floats to objects.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
float
array
* @return a Float
array, null
if null array input
@@ -2671,7 +2680,7 @@ public static Float[] toObject(float[] array) {
/**
* Converts an array of object Booleans to primitives.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
Boolean
array, may be null
* @return a boolean
array, null
if null array input
@@ -2693,7 +2702,7 @@ public static boolean[] toPrimitive(Boolean[] array) {
/**
* Converts an array of object Booleans to primitives handling null
.
This method returns null
if null
array input.
This method returns null
for a null
input array.
Boolean
array, may be null
* @param valueForNull the value to insert if null
found
@@ -2716,7 +2725,7 @@ public static boolean[] toPrimitive(Boolean[] array, boolean valueForNull) {
/**
* Converts an array of primitive booleans to objects.
* - *This method returns null
if null
array input.
This method returns null
for a null
input array.
boolean
array
* @return a Boolean
array, null
if null array input
@@ -3774,7 +3783,7 @@ public static Object[] remove(Object[] array, int index) {
*/
public static Object[] removeElement(Object[] array, Object element) {
int index = indexOf(array, element);
- if (index == -1) {
+ if (index == INDEX_NOT_FOUND) {
return clone(array);
}
return remove(array, index);
@@ -3839,7 +3848,7 @@ public static boolean[] remove(boolean[] array, int index) {
*/
public static boolean[] removeElement(boolean[] array, boolean element) {
int index = indexOf(array, element);
- if (index == -1) {
+ if (index == INDEX_NOT_FOUND) {
return clone(array);
}
return remove(array, index);
@@ -3904,7 +3913,7 @@ public static byte[] remove(byte[] array, int index) {
*/
public static byte[] removeElement(byte[] array, byte element) {
int index = indexOf(array, element);
- if (index == -1) {
+ if (index == INDEX_NOT_FOUND) {
return clone(array);
}
return remove(array, index);
@@ -3969,7 +3978,7 @@ public static char[] remove(char[] array, int index) {
*/
public static char[] removeElement(char[] array, char element) {
int index = indexOf(array, element);
- if (index == -1) {
+ if (index == INDEX_NOT_FOUND) {
return clone(array);
}
return remove(array, index);
@@ -4034,7 +4043,7 @@ public static double[] remove(double[] array, int index) {
*/
public static double[] removeElement(double[] array, double element) {
int index = indexOf(array, element);
- if (index == -1) {
+ if (index == INDEX_NOT_FOUND) {
return clone(array);
}
return remove(array, index);
@@ -4099,7 +4108,7 @@ public static float[] remove(float[] array, int index) {
*/
public static float[] removeElement(float[] array, float element) {
int index = indexOf(array, element);
- if (index == -1) {
+ if (index == INDEX_NOT_FOUND) {
return clone(array);
}
return remove(array, index);
@@ -4164,7 +4173,7 @@ public static int[] remove(int[] array, int index) {
*/
public static int[] removeElement(int[] array, int element) {
int index = indexOf(array, element);
- if (index == -1) {
+ if (index == INDEX_NOT_FOUND) {
return clone(array);
}
return remove(array, index);
@@ -4229,7 +4238,7 @@ public static long[] remove(long[] array, int index) {
*/
public static long[] removeElement(long[] array, long element) {
int index = indexOf(array, element);
- if (index == -1) {
+ if (index == INDEX_NOT_FOUND) {
return clone(array);
}
return remove(array, index);
@@ -4294,7 +4303,7 @@ public static short[] remove(short[] array, int index) {
*/
public static short[] removeElement(short[] array, short element) {
int index = indexOf(array, element);
- if (index == -1) {
+ if (index == INDEX_NOT_FOUND) {
return clone(array);
}
return remove(array, index);