| java.lang.Object org.apache.commons.lang.ArrayUtils
ArrayUtils | public class ArrayUtils (Code) | | Operations on arrays, primitive arrays (like int[] ) and
primitive wrapper arrays (like Integer[] ).
This class tries to handle null input gracefully.
An exception will not be thrown for a null
array input. However, an Object array that contains a null
element may throw an exception. Each method documents its behaviour.
author: Stephen Colebourne author: Moritz Petersen author: Fredrik Westermarck author: Nikolay Metchev author: Matthew Hawthorne author: Tim O'Brien author: Pete Gieser author: Gary Gregory author: Ashwin S author: Maarten Coene since: 2.0 version: $Id: ArrayUtils.java 437554 2006-08-28 06:21:41Z bayard $ |
Constructor Summary | |
public | ArrayUtils() ArrayUtils instances should NOT be constructed in standard programming. |
Method Summary | |
public static Object[] | add(Object[] array, Object element) Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. | public static boolean[] | add(boolean[] array, boolean element) Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. | public static byte[] | add(byte[] array, byte element) Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. | public static char[] | add(char[] array, char element) Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. | public static double[] | add(double[] array, double element) Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. | public static float[] | add(float[] array, float element) Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. | public static int[] | add(int[] array, int element) Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. | public static long[] | add(long[] array, long element) Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. | public static short[] | add(short[] array, short element) Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. | public static Object[] | add(Object[] array, int index, Object element) Inserts the specified element at the specified position in the array. | public static boolean[] | add(boolean[] array, int index, boolean element) Inserts the specified element at the specified position in the array. | public static char[] | add(char[] array, int index, char element) Inserts the specified element at the specified position in the array. | public static byte[] | add(byte[] array, int index, byte element) Inserts the specified element at the specified position in the array. | public static short[] | add(short[] array, int index, short element) Inserts the specified element at the specified position in the array. | public static int[] | add(int[] array, int index, int element) Inserts the specified element at the specified position in the array. | public static long[] | add(long[] array, int index, long element) Inserts the specified element at the specified position in the array. | public static float[] | add(float[] array, int index, float element) Inserts the specified element at the specified position in the array. | public static double[] | add(double[] array, int index, double element) Inserts the specified element at the specified position in the array. | public static Object[] | addAll(Object[] array1, Object[] array2) Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . | public static boolean[] | addAll(boolean[] array1, boolean[] array2) Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . | public static char[] | addAll(char[] array1, char[] array2) Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . | public static byte[] | addAll(byte[] array1, byte[] array2) Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . | public static short[] | addAll(short[] array1, short[] array2) Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . | public static int[] | addAll(int[] array1, int[] array2) Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . | public static long[] | addAll(long[] array1, long[] array2) Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . | public static float[] | addAll(float[] array1, float[] array2) Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . | public static double[] | addAll(double[] array1, double[] array2) Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . | public static Object[] | clone(Object[] array) | public static long[] | clone(long[] array) | public static int[] | clone(int[] array) | public static short[] | clone(short[] array) | public static char[] | clone(char[] array) | public static byte[] | clone(byte[] array) | public static double[] | clone(double[] array) | public static float[] | clone(float[] array) | public static boolean[] | clone(boolean[] array) | public static boolean | contains(Object[] array, Object objectToFind) | public static boolean | contains(long[] array, long valueToFind) | public static boolean | contains(int[] array, int valueToFind) | public static boolean | contains(short[] array, short valueToFind) | public static boolean | contains(char[] array, char valueToFind) | public static boolean | contains(byte[] array, byte valueToFind) | public static boolean | contains(double[] array, double valueToFind) | public static boolean | contains(double[] array, double valueToFind, double tolerance) Checks if a value falling within the given tolerance is in the
given array. | public static boolean | contains(float[] array, float valueToFind) | public static boolean | contains(boolean[] array, boolean valueToFind) | public static int | getLength(Object array) Returns the length of the specified array. | public static int | hashCode(Object array) | public static int | indexOf(Object[] array, Object objectToFind) | public static int | indexOf(Object[] array, Object objectToFind, int startIndex) Finds the index of the given object in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex is treated as zero. | public static int | indexOf(long[] array, long valueToFind) | public static int | indexOf(long[] array, long valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex is treated as zero. | public static int | indexOf(int[] array, int valueToFind) | public static int | indexOf(int[] array, int valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex is treated as zero. | public static int | indexOf(short[] array, short valueToFind) | public static int | indexOf(short[] array, short valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex is treated as zero. | public static int | indexOf(char[] array, char valueToFind) | public static int | indexOf(char[] array, char valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex is treated as zero. | public static int | indexOf(byte[] array, byte valueToFind) | public static int | indexOf(byte[] array, byte valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex is treated as zero. | public static int | indexOf(double[] array, double valueToFind) | public static int | indexOf(double[] array, double valueToFind, double tolerance) Finds the index of the given value within a given tolerance in the array. | public static int | indexOf(double[] array, double valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex is treated as zero. | public static int | indexOf(double[] array, double valueToFind, int startIndex, double tolerance) 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
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex is treated as zero. | public static int | indexOf(float[] array, float valueToFind) | public static int | indexOf(float[] array, float valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex is treated as zero. | public static int | indexOf(boolean[] array, boolean valueToFind) | public static int | indexOf(boolean[] array, boolean valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex is treated as zero. | public static boolean | isEmpty(Object[] array) | public static boolean | isEmpty(long[] array) | public static boolean | isEmpty(int[] array) | public static boolean | isEmpty(short[] array) | public static boolean | isEmpty(char[] array) | public static boolean | isEmpty(byte[] array) | public static boolean | isEmpty(double[] array) | public static boolean | isEmpty(float[] array) | public static boolean | isEmpty(boolean[] array) | public static boolean | isEquals(Object array1, Object array2) | public static boolean | isSameLength(Object[] array1, Object[] array2) Checks whether two arrays are the same length, treating
null arrays as length 0 . | public static boolean | isSameLength(long[] array1, long[] array2) | public static boolean | isSameLength(int[] array1, int[] array2) | public static boolean | isSameLength(short[] array1, short[] array2) | public static boolean | isSameLength(char[] array1, char[] array2) | public static boolean | isSameLength(byte[] array1, byte[] array2) | public static boolean | isSameLength(double[] array1, double[] array2) | public static boolean | isSameLength(float[] array1, float[] array2) | public static boolean | isSameLength(boolean[] array1, boolean[] array2) | public static boolean | isSameType(Object array1, Object array2) | public static int | lastIndexOf(Object[] array, Object objectToFind) | public static int | lastIndexOf(Object[] array, Object objectToFind, int startIndex) Finds the last index of the given object in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). | public static int | lastIndexOf(long[] array, long valueToFind) | public static int | lastIndexOf(long[] array, long valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). | public static int | lastIndexOf(int[] array, int valueToFind) | public static int | lastIndexOf(int[] array, int valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). | public static int | lastIndexOf(short[] array, short valueToFind) | public static int | lastIndexOf(short[] array, short valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). | public static int | lastIndexOf(char[] array, char valueToFind) | public static int | lastIndexOf(char[] array, char valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). | public static int | lastIndexOf(byte[] array, byte valueToFind) | public static int | lastIndexOf(byte[] array, byte valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). | public static int | lastIndexOf(double[] array, double valueToFind) | public static int | lastIndexOf(double[] array, double valueToFind, double tolerance) Finds the last index of the given value within a given tolerance in the array. | public static int | lastIndexOf(double[] array, double valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). | public static int | lastIndexOf(double[] array, double valueToFind, int startIndex, double tolerance) 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
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). | public static int | lastIndexOf(float[] array, float valueToFind) | public static int | lastIndexOf(float[] array, float valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). | public static int | lastIndexOf(boolean[] array, boolean valueToFind) | public static int | lastIndexOf(boolean[] array, boolean valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). | public static Object[] | remove(Object[] array, int index) Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. | public static boolean[] | remove(boolean[] array, int index) Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. | public static byte[] | remove(byte[] array, int index) Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. | public static char[] | remove(char[] array, int index) Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. | public static double[] | remove(double[] array, int index) Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. | public static float[] | remove(float[] array, int index) Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. | public static int[] | remove(int[] array, int index) Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. | public static long[] | remove(long[] array, int index) Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. | public static short[] | remove(short[] array, int index) Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. | public static Object[] | removeElement(Object[] array, Object element) Removes the first occurrence of the specified element from the
specified array. | public static boolean[] | removeElement(boolean[] array, boolean element) Removes the first occurrence of the specified element from the
specified array. | public static byte[] | removeElement(byte[] array, byte element) Removes the first occurrence of the specified element from the
specified array. | public static char[] | removeElement(char[] array, char element) Removes the first occurrence of the specified element from the
specified array. | public static double[] | removeElement(double[] array, double element) Removes the first occurrence of the specified element from the
specified array. | public static float[] | removeElement(float[] array, float element) Removes the first occurrence of the specified element from the
specified array. | public static int[] | removeElement(int[] array, int element) Removes the first occurrence of the specified element from the
specified array. | public static long[] | removeElement(long[] array, long element) Removes the first occurrence of the specified element from the
specified array. | public static short[] | removeElement(short[] array, short element) Removes the first occurrence of the specified element from the
specified array. | public static void | reverse(Object[] array) | public static void | reverse(long[] array) | public static void | reverse(int[] array) | public static void | reverse(short[] array) | public static void | reverse(char[] array) | public static void | reverse(byte[] array) | public static void | reverse(double[] array) | public static void | reverse(float[] array) | public static void | reverse(boolean[] array) | public static Object[] | subarray(Object[] array, int startIndexInclusive, int endIndexExclusive) Produces a new array containing the elements between
the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
The component type of the subarray is always the same as
that of the input array. | public static long[] | subarray(long[] array, int startIndexInclusive, int endIndexExclusive) Produces a new long array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. | public static int[] | subarray(int[] array, int startIndexInclusive, int endIndexExclusive) Produces a new int array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. | public static short[] | subarray(short[] array, int startIndexInclusive, int endIndexExclusive) Produces a new short array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. | public static char[] | subarray(char[] array, int startIndexInclusive, int endIndexExclusive) Produces a new char array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. | public static byte[] | subarray(byte[] array, int startIndexInclusive, int endIndexExclusive) Produces a new byte array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. | public static double[] | subarray(double[] array, int startIndexInclusive, int endIndexExclusive) Produces a new double array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. | public static float[] | subarray(float[] array, int startIndexInclusive, int endIndexExclusive) Produces a new float array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. | public static boolean[] | subarray(boolean[] array, int startIndexInclusive, int endIndexExclusive) Produces a new boolean array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. | public static Map | toMap(Object[] array) Converts the given array into a
java.util.Map . | public static Character[] | toObject(char[] array) | public static Long[] | toObject(long[] array) | public static Integer[] | toObject(int[] array) | public static Short[] | toObject(short[] array) | public static Byte[] | toObject(byte[] array) | public static Double[] | toObject(double[] array) | public static Float[] | toObject(float[] array) | public static Boolean[] | toObject(boolean[] array) | public static char[] | toPrimitive(Character[] array) | public static char[] | toPrimitive(Character[] array, char valueForNull) | public static long[] | toPrimitive(Long[] array) | public static long[] | toPrimitive(Long[] array, long valueForNull) | public static int[] | toPrimitive(Integer[] array) | public static int[] | toPrimitive(Integer[] array, int valueForNull) | public static short[] | toPrimitive(Short[] array) | public static short[] | toPrimitive(Short[] array, short valueForNull) | public static byte[] | toPrimitive(Byte[] array) | public static byte[] | toPrimitive(Byte[] array, byte valueForNull) | public static double[] | toPrimitive(Double[] array) | public static double[] | toPrimitive(Double[] array, double valueForNull) | public static float[] | toPrimitive(Float[] array) | public static float[] | toPrimitive(Float[] array, float valueForNull) | public static boolean[] | toPrimitive(Boolean[] array) | public static boolean[] | toPrimitive(Boolean[] array, boolean valueForNull) | public static String | toString(Object array) | public static String | toString(Object array, String stringIfNull) |
EMPTY_BOOLEAN_ARRAY | final public static boolean[] EMPTY_BOOLEAN_ARRAY(Code) | | An empty immutable boolean array.
|
EMPTY_BOOLEAN_OBJECT_ARRAY | final public static Boolean[] EMPTY_BOOLEAN_OBJECT_ARRAY(Code) | | An empty immutable Boolean array.
|
EMPTY_BYTE_ARRAY | final public static byte[] EMPTY_BYTE_ARRAY(Code) | | An empty immutable byte array.
|
EMPTY_BYTE_OBJECT_ARRAY | final public static Byte[] EMPTY_BYTE_OBJECT_ARRAY(Code) | | An empty immutable Byte array.
|
EMPTY_CHARACTER_OBJECT_ARRAY | final public static Character[] EMPTY_CHARACTER_OBJECT_ARRAY(Code) | | An empty immutable Character array.
|
EMPTY_CHAR_ARRAY | final public static char[] EMPTY_CHAR_ARRAY(Code) | | An empty immutable char array.
|
EMPTY_CLASS_ARRAY | final public static Class[] EMPTY_CLASS_ARRAY(Code) | | An empty immutable Class array.
|
EMPTY_DOUBLE_ARRAY | final public static double[] EMPTY_DOUBLE_ARRAY(Code) | | An empty immutable double array.
|
EMPTY_DOUBLE_OBJECT_ARRAY | final public static Double[] EMPTY_DOUBLE_OBJECT_ARRAY(Code) | | An empty immutable Double array.
|
EMPTY_FLOAT_ARRAY | final public static float[] EMPTY_FLOAT_ARRAY(Code) | | An empty immutable float array.
|
EMPTY_FLOAT_OBJECT_ARRAY | final public static Float[] EMPTY_FLOAT_OBJECT_ARRAY(Code) | | An empty immutable Float array.
|
EMPTY_INTEGER_OBJECT_ARRAY | final public static Integer[] EMPTY_INTEGER_OBJECT_ARRAY(Code) | | An empty immutable Integer array.
|
EMPTY_INT_ARRAY | final public static int[] EMPTY_INT_ARRAY(Code) | | An empty immutable int array.
|
EMPTY_LONG_ARRAY | final public static long[] EMPTY_LONG_ARRAY(Code) | | An empty immutable long array.
|
EMPTY_LONG_OBJECT_ARRAY | final public static Long[] EMPTY_LONG_OBJECT_ARRAY(Code) | | An empty immutable Long array.
|
EMPTY_OBJECT_ARRAY | final public static Object[] EMPTY_OBJECT_ARRAY(Code) | | An empty immutable Object array.
|
EMPTY_SHORT_ARRAY | final public static short[] EMPTY_SHORT_ARRAY(Code) | | An empty immutable short array.
|
EMPTY_SHORT_OBJECT_ARRAY | final public static Short[] EMPTY_SHORT_OBJECT_ARRAY(Code) | | An empty immutable Short array.
|
EMPTY_STRING_ARRAY | final public static String[] EMPTY_STRING_ARRAY(Code) | | An empty immutable String array.
|
INDEX_NOT_FOUND | final public static int INDEX_NOT_FOUND(Code) | | 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
java.util.List .
|
ArrayUtils | public ArrayUtils()(Code) | | ArrayUtils instances should NOT be constructed in standard programming.
Instead, the class should be used as ArrayUtils.clone(new int[] {2}) .
This constructor is public to permit tools that require a JavaBean instance
to operate.
|
add | public static Object[] add(Object[] array, Object element)(Code) | | Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. The component type of
the new array is the same as that of the input array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, null) = [null]
ArrayUtils.add(null, "a") = ["a"]
ArrayUtils.add(["a"], null) = ["a", null]
ArrayUtils.add(["a"], "b") = ["a", "b"]
ArrayUtils.add(["a", "b"], "c") = ["a", "b", "c"]
Parameters: array - the array to "add" the element to, may be null Parameters: element - the object to add A new array containing the existing elements plus the new element since: 2.1 |
add | public static boolean[] add(boolean[] array, boolean element)(Code) | | Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. The component type of
the new array is the same as that of the input array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, true) = [true]
ArrayUtils.add([true], false) = [true, false]
ArrayUtils.add([true, false], true) = [true, false, true]
Parameters: array - the array to copy and add the element to, may be null Parameters: element - the object to add at the last index of the new array A new array containing the existing elements plus the new element since: 2.1 |
add | public static byte[] add(byte[] array, byte element)(Code) | | Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. The component type of
the new array is the same as that of the input array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, 0) = [0]
ArrayUtils.add([1], 0) = [1, 0]
ArrayUtils.add([1, 0], 1) = [1, 0, 1]
Parameters: array - the array to copy and add the element to, may be null Parameters: element - the object to add at the last index of the new array A new array containing the existing elements plus the new element since: 2.1 |
add | public static char[] add(char[] array, char element)(Code) | | Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. The component type of
the new array is the same as that of the input array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, '0') = ['0']
ArrayUtils.add(['1'], '0') = ['1', '0']
ArrayUtils.add(['1', '0'], '1') = ['1', '0', '1']
Parameters: array - the array to copy and add the element to, may be null Parameters: element - the object to add at the last index of the new array A new array containing the existing elements plus the new element since: 2.1 |
add | public static double[] add(double[] array, double element)(Code) | | Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. The component type of
the new array is the same as that of the input array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, 0) = [0]
ArrayUtils.add([1], 0) = [1, 0]
ArrayUtils.add([1, 0], 1) = [1, 0, 1]
Parameters: array - the array to copy and add the element to, may be null Parameters: element - the object to add at the last index of the new array A new array containing the existing elements plus the new element since: 2.1 |
add | public static float[] add(float[] array, float element)(Code) | | Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. The component type of
the new array is the same as that of the input array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, 0) = [0]
ArrayUtils.add([1], 0) = [1, 0]
ArrayUtils.add([1, 0], 1) = [1, 0, 1]
Parameters: array - the array to copy and add the element to, may be null Parameters: element - the object to add at the last index of the new array A new array containing the existing elements plus the new element since: 2.1 |
add | public static int[] add(int[] array, int element)(Code) | | Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. The component type of
the new array is the same as that of the input array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, 0) = [0]
ArrayUtils.add([1], 0) = [1, 0]
ArrayUtils.add([1, 0], 1) = [1, 0, 1]
Parameters: array - the array to copy and add the element to, may be null Parameters: element - the object to add at the last index of the new array A new array containing the existing elements plus the new element since: 2.1 |
add | public static long[] add(long[] array, long element)(Code) | | Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. The component type of
the new array is the same as that of the input array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, 0) = [0]
ArrayUtils.add([1], 0) = [1, 0]
ArrayUtils.add([1, 0], 1) = [1, 0, 1]
Parameters: array - the array to copy and add the element to, may be null Parameters: element - the object to add at the last index of the new array A new array containing the existing elements plus the new element since: 2.1 |
add | public static short[] add(short[] array, short element)(Code) | | Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the input
array plus the given element in the last position. The component type of
the new array is the same as that of the input array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, 0) = [0]
ArrayUtils.add([1], 0) = [1, 0]
ArrayUtils.add([1, 0], 1) = [1, 0, 1]
Parameters: array - the array to copy and add the element to, may be null Parameters: element - the object to add at the last index of the new array A new array containing the existing elements plus the new element since: 2.1 |
add | public static Object[] add(Object[] array, int index, Object element)(Code) | | Inserts the specified element at the specified position in the array.
Shifts the element currently at that position (if any) and any subsequent
elements to the right (adds one to their indices).
This method returns a new array with the same elements of the input
array plus the given element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, 0, null) = [null]
ArrayUtils.add(null, 0, "a") = ["a"]
ArrayUtils.add(["a"], 1, null) = ["a", null]
ArrayUtils.add(["a"], 1, "b") = ["a", "b"]
ArrayUtils.add(["a", "b"], 3, "c") = ["a", "b", "c"]
Parameters: array - the array to add the element to, may be null Parameters: index - the position of the new object Parameters: element - the object to add A new array containing the existing elements and the new element throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index > array.length). |
add | public static boolean[] add(boolean[] array, int index, boolean element)(Code) | | Inserts the specified element at the specified position in the array.
Shifts the element currently at that position (if any) and any subsequent
elements to the right (adds one to their indices).
This method returns a new array with the same elements of the input
array plus the given element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, 0, true) = [true]
ArrayUtils.add([true], 0, false) = [false, true]
ArrayUtils.add([false], 1, true) = [false, true]
ArrayUtils.add([true, false], 1, true) = [true, true, false]
Parameters: array - the array to add the element to, may be null Parameters: index - the position of the new object Parameters: element - the object to add A new array containing the existing elements and the new element throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index > array.length). |
add | public static char[] add(char[] array, int index, char element)(Code) | | Inserts the specified element at the specified position in the array.
Shifts the element currently at that position (if any) and any subsequent
elements to the right (adds one to their indices).
This method returns a new array with the same elements of the input
array plus the given element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add(null, 0, 'a') = ['a']
ArrayUtils.add(['a'], 0, 'b') = ['b', 'a']
ArrayUtils.add(['a', 'b'], 0, 'c') = ['c', 'a', 'b']
ArrayUtils.add(['a', 'b'], 1, 'k') = ['a', 'k', 'b']
ArrayUtils.add(['a', 'b', 'c'], 1, 't') = ['a', 't', 'b', 'c']
Parameters: array - the array to add the element to, may be null Parameters: index - the position of the new object Parameters: element - the object to add A new array containing the existing elements and the new element throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index > array.length). |
add | public static byte[] add(byte[] array, int index, byte element)(Code) | | Inserts the specified element at the specified position in the array.
Shifts the element currently at that position (if any) and any subsequent
elements to the right (adds one to their indices).
This method returns a new array with the same elements of the input
array plus the given element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add([1], 0, 2) = [2, 1]
ArrayUtils.add([2, 6], 2, 3) = [2, 6, 3]
ArrayUtils.add([2, 6], 0, 1) = [1, 2, 6]
ArrayUtils.add([2, 6, 3], 2, 1) = [2, 6, 1, 3]
Parameters: array - the array to add the element to, may be null Parameters: index - the position of the new object Parameters: element - the object to add A new array containing the existing elements and the new element throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index > array.length). |
add | public static short[] add(short[] array, int index, short element)(Code) | | Inserts the specified element at the specified position in the array.
Shifts the element currently at that position (if any) and any subsequent
elements to the right (adds one to their indices).
This method returns a new array with the same elements of the input
array plus the given element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add([1], 0, 2) = [2, 1]
ArrayUtils.add([2, 6], 2, 10) = [2, 6, 10]
ArrayUtils.add([2, 6], 0, -4) = [-4, 2, 6]
ArrayUtils.add([2, 6, 3], 2, 1) = [2, 6, 1, 3]
Parameters: array - the array to add the element to, may be null Parameters: index - the position of the new object Parameters: element - the object to add A new array containing the existing elements and the new element throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index > array.length). |
add | public static int[] add(int[] array, int index, int element)(Code) | | Inserts the specified element at the specified position in the array.
Shifts the element currently at that position (if any) and any subsequent
elements to the right (adds one to their indices).
This method returns a new array with the same elements of the input
array plus the given element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add([1], 0, 2) = [2, 1]
ArrayUtils.add([2, 6], 2, 10) = [2, 6, 10]
ArrayUtils.add([2, 6], 0, -4) = [-4, 2, 6]
ArrayUtils.add([2, 6, 3], 2, 1) = [2, 6, 1, 3]
Parameters: array - the array to add the element to, may be null Parameters: index - the position of the new object Parameters: element - the object to add A new array containing the existing elements and the new element throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index > array.length). |
add | public static long[] add(long[] array, int index, long element)(Code) | | Inserts the specified element at the specified position in the array.
Shifts the element currently at that position (if any) and any subsequent
elements to the right (adds one to their indices).
This method returns a new array with the same elements of the input
array plus the given element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add([1L], 0, 2L) = [2L, 1L]
ArrayUtils.add([2L, 6L], 2, 10L) = [2L, 6L, 10L]
ArrayUtils.add([2L, 6L], 0, -4L) = [-4L, 2L, 6L]
ArrayUtils.add([2L, 6L, 3L], 2, 1L) = [2L, 6L, 1L, 3L]
Parameters: array - the array to add the element to, may be null Parameters: index - the position of the new object Parameters: element - the object to add A new array containing the existing elements and the new element throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index > array.length). |
add | public static float[] add(float[] array, int index, float element)(Code) | | Inserts the specified element at the specified position in the array.
Shifts the element currently at that position (if any) and any subsequent
elements to the right (adds one to their indices).
This method returns a new array with the same elements of the input
array plus the given element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add([1.1f], 0, 2.2f) = [2.2f, 1.1f]
ArrayUtils.add([2.3f, 6.4f], 2, 10.5f) = [2.3f, 6.4f, 10.5f]
ArrayUtils.add([2.6f, 6.7f], 0, -4.8f) = [-4.8f, 2.6f, 6.7f]
ArrayUtils.add([2.9f, 6.0f, 0.3f], 2, 1.0f) = [2.9f, 6.0f, 1.0f, 0.3f]
Parameters: array - the array to add the element to, may be null Parameters: index - the position of the new object Parameters: element - the object to add A new array containing the existing elements and the new element throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index > array.length). |
add | public static double[] add(double[] array, int index, double element)(Code) | | Inserts the specified element at the specified position in the array.
Shifts the element currently at that position (if any) and any subsequent
elements to the right (adds one to their indices).
This method returns a new array with the same elements of the input
array plus the given element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , a new one element array is returned
whose component type is the same as the element.
ArrayUtils.add([1.1], 0, 2.2) = [2.2, 1.1]
ArrayUtils.add([2.3, 6.4], 2, 10.5) = [2.3, 6.4, 10.5]
ArrayUtils.add([2.6, 6.7], 0, -4.8) = [-4.8, 2.6, 6.7]
ArrayUtils.add([2.9, 6.0, 0.3], 2, 1.0) = [2.9, 6.0, 1.0, 0.3]
Parameters: array - the array to add the element to, may be null Parameters: index - the position of the new object Parameters: element - the object to add A new array containing the existing elements and the new element throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index > array.length). |
addAll | public static Object[] addAll(Object[] array1, Object[] array2)(Code) | | Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . When an array is returned, it is always
a new array.
ArrayUtils.addAll(null, null) = null
ArrayUtils.addAll(array1, null) = cloned copy of array1
ArrayUtils.addAll(null, array2) = cloned copy of array2
ArrayUtils.addAll([], []) = []
ArrayUtils.addAll([null], [null]) = [null, null]
ArrayUtils.addAll(["a", "b", "c"], ["1", "2", "3"]) = ["a", "b", "c", "1", "2", "3"]
Parameters: array1 - the first array whose elements are added to the new array, may be null Parameters: array2 - the second array whose elements are added to the new array, may be null The new array, null if null array inputs. The type of the new array is the type of the first array. since: 2.1 |
addAll | public static boolean[] addAll(boolean[] array1, boolean[] array2)(Code) | | Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . When an array is returned, it is always
a new array.
ArrayUtils.addAll(array1, null) = cloned copy of array1
ArrayUtils.addAll(null, array2) = cloned copy of array2
ArrayUtils.addAll([], []) = []
Parameters: array1 - the first array whose elements are added to the new array. Parameters: array2 - the second array whose elements are added to the new array. The new boolean[] array. since: 2.1 |
addAll | public static char[] addAll(char[] array1, char[] array2)(Code) | | Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . When an array is returned, it is always
a new array.
ArrayUtils.addAll(array1, null) = cloned copy of array1
ArrayUtils.addAll(null, array2) = cloned copy of array2
ArrayUtils.addAll([], []) = []
Parameters: array1 - the first array whose elements are added to the new array. Parameters: array2 - the second array whose elements are added to the new array. The new char[] array. since: 2.1 |
addAll | public static byte[] addAll(byte[] array1, byte[] array2)(Code) | | Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . When an array is returned, it is always
a new array.
ArrayUtils.addAll(array1, null) = cloned copy of array1
ArrayUtils.addAll(null, array2) = cloned copy of array2
ArrayUtils.addAll([], []) = []
Parameters: array1 - the first array whose elements are added to the new array. Parameters: array2 - the second array whose elements are added to the new array. The new byte[] array. since: 2.1 |
addAll | public static short[] addAll(short[] array1, short[] array2)(Code) | | Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . When an array is returned, it is always
a new array.
ArrayUtils.addAll(array1, null) = cloned copy of array1
ArrayUtils.addAll(null, array2) = cloned copy of array2
ArrayUtils.addAll([], []) = []
Parameters: array1 - the first array whose elements are added to the new array. Parameters: array2 - the second array whose elements are added to the new array. The new short[] array. since: 2.1 |
addAll | public static int[] addAll(int[] array1, int[] array2)(Code) | | Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . When an array is returned, it is always
a new array.
ArrayUtils.addAll(array1, null) = cloned copy of array1
ArrayUtils.addAll(null, array2) = cloned copy of array2
ArrayUtils.addAll([], []) = []
Parameters: array1 - the first array whose elements are added to the new array. Parameters: array2 - the second array whose elements are added to the new array. The new int[] array. since: 2.1 |
addAll | public static long[] addAll(long[] array1, long[] array2)(Code) | | Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . When an array is returned, it is always
a new array.
ArrayUtils.addAll(array1, null) = cloned copy of array1
ArrayUtils.addAll(null, array2) = cloned copy of array2
ArrayUtils.addAll([], []) = []
Parameters: array1 - the first array whose elements are added to the new array. Parameters: array2 - the second array whose elements are added to the new array. The new long[] array. since: 2.1 |
addAll | public static float[] addAll(float[] array1, float[] array2)(Code) | | Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . When an array is returned, it is always
a new array.
ArrayUtils.addAll(array1, null) = cloned copy of array1
ArrayUtils.addAll(null, array2) = cloned copy of array2
ArrayUtils.addAll([], []) = []
Parameters: array1 - the first array whose elements are added to the new array. Parameters: array2 - the second array whose elements are added to the new array. The new float[] array. since: 2.1 |
addAll | public static double[] addAll(double[] array1, double[] array2)(Code) | | Adds all the elements of the given arrays into a new array.
The new array contains all of the element of array1 followed
by all of the elements array2 . When an array is returned, it is always
a new array.
ArrayUtils.addAll(array1, null) = cloned copy of array1
ArrayUtils.addAll(null, array2) = cloned copy of array2
ArrayUtils.addAll([], []) = []
Parameters: array1 - the first array whose elements are added to the new array. Parameters: array2 - the second array whose elements are added to the new array. The new double[] array. since: 2.1 |
clone | public static Object[] clone(Object[] array)(Code) | | Shallow clones an array returning a typecast result and handling
null .
The objects in the array are not cloned, thus there is no special
handling for multi-dimensional arrays.
This method returns null for a null input array.
Parameters: array - the array to shallow clone, may be null the cloned array, null if null input |
clone | public static long[] clone(long[] array)(Code) | | Clones an array returning a typecast result and handling
null .
This method returns null for a null input array.
Parameters: array - the array to clone, may be null the cloned array, null if null input |
clone | public static int[] clone(int[] array)(Code) | | Clones an array returning a typecast result and handling
null .
This method returns null for a null input array.
Parameters: array - the array to clone, may be null the cloned array, null if null input |
clone | public static short[] clone(short[] array)(Code) | | Clones an array returning a typecast result and handling
null .
This method returns null for a null input array.
Parameters: array - the array to clone, may be null the cloned array, null if null input |
clone | public static char[] clone(char[] array)(Code) | | Clones an array returning a typecast result and handling
null .
This method returns null for a null input array.
Parameters: array - the array to clone, may be null the cloned array, null if null input |
clone | public static byte[] clone(byte[] array)(Code) | | Clones an array returning a typecast result and handling
null .
This method returns null for a null input array.
Parameters: array - the array to clone, may be null the cloned array, null if null input |
clone | public static double[] clone(double[] array)(Code) | | Clones an array returning a typecast result and handling
null .
This method returns null for a null input array.
Parameters: array - the array to clone, may be null the cloned array, null if null input |
clone | public static float[] clone(float[] array)(Code) | | Clones an array returning a typecast result and handling
null .
This method returns null for a null input array.
Parameters: array - the array to clone, may be null the cloned array, null if null input |
clone | public static boolean[] clone(boolean[] array)(Code) | | Clones an array returning a typecast result and handling
null .
This method returns null for a null input array.
Parameters: array - the array to clone, may be null the cloned array, null if null input |
contains | public static boolean contains(Object[] array, Object objectToFind)(Code) | | Checks if the object is in the given array.
The method returns false if a null array is passed in.
Parameters: array - the array to search through Parameters: objectToFind - the object to find true if the array contains the object |
contains | public static boolean contains(long[] array, long valueToFind)(Code) | | Checks if the value is in the given array.
The method returns false if a null array is passed in.
Parameters: array - the array to search through Parameters: valueToFind - the value to find true if the array contains the object |
contains | public static boolean contains(int[] array, int valueToFind)(Code) | | Checks if the value is in the given array.
The method returns false if a null array is passed in.
Parameters: array - the array to search through Parameters: valueToFind - the value to find true if the array contains the object |
contains | public static boolean contains(short[] array, short valueToFind)(Code) | | Checks if the value is in the given array.
The method returns false if a null array is passed in.
Parameters: array - the array to search through Parameters: valueToFind - the value to find true if the array contains the object |
contains | public static boolean contains(char[] array, char valueToFind)(Code) | | Checks if the value is in the given array.
The method returns false if a null array is passed in.
Parameters: array - the array to search through Parameters: valueToFind - the value to find true if the array contains the object since: 2.1 |
contains | public static boolean contains(byte[] array, byte valueToFind)(Code) | | Checks if the value is in the given array.
The method returns false if a null array is passed in.
Parameters: array - the array to search through Parameters: valueToFind - the value to find true if the array contains the object |
contains | public static boolean contains(double[] array, double valueToFind)(Code) | | Checks if the value is in the given array.
The method returns false if a null array is passed in.
Parameters: array - the array to search through Parameters: valueToFind - the value to find true if the array contains the object |
contains | public static boolean contains(double[] array, double valueToFind, double tolerance)(Code) | | Checks if a value falling within the given tolerance is in the
given array. If the array contains a value within the inclusive range
defined by (value - tolerance) to (value + tolerance).
The method returns false if a null array
is passed in.
Parameters: array - the array to search Parameters: valueToFind - the value to find Parameters: tolerance - the array contains the tolerance of the search true if value falling within tolerance is in array |
contains | public static boolean contains(float[] array, float valueToFind)(Code) | | Checks if the value is in the given array.
The method returns false if a null array is passed in.
Parameters: array - the array to search through Parameters: valueToFind - the value to find true if the array contains the object |
contains | public static boolean contains(boolean[] array, boolean valueToFind)(Code) | | Checks if the value is in the given array.
The method returns false if a null array is passed in.
Parameters: array - the array to search through Parameters: valueToFind - the value to find true if the array contains the object |
getLength | public static int getLength(Object array)(Code) | | Returns the length of the specified array.
This method can deal with Object arrays and with primitive arrays.
If the input array is null , 0 is returned.
ArrayUtils.getLength(null) = 0
ArrayUtils.getLength([]) = 0
ArrayUtils.getLength([null]) = 1
ArrayUtils.getLength([true, false]) = 2
ArrayUtils.getLength([1, 2, 3]) = 3
ArrayUtils.getLength(["a", "b", "c"]) = 3
Parameters: array - the array to retrieve the length from, may be null The length of the array, or 0 if the array is null throws: IllegalArgumentException - if the object arguement is not an array. since: 2.1 |
hashCode | public static int hashCode(Object array)(Code) | | Get a hashCode for an array handling multi-dimensional arrays correctly.
Multi-dimensional primitive arrays are also handled correctly by this method.
Parameters: array - the array to get a hashCode for, may be null a hashCode for the array, zero if null array input |
indexOf | public static int indexOf(Object[] array, Object objectToFind)(Code) | | Finds the index of the given object in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to search through for the object, may be null Parameters: objectToFind - the object to find, may be null the index of the object within the array, ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(Object[] array, Object objectToFind, int startIndex)(Code) | | Finds the index of the given object in the array starting at the given index.
This method returns
ArrayUtils.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
ArrayUtils.INDEX_NOT_FOUND (-1 ).
Parameters: array - the array to search through for the object, may be null Parameters: objectToFind - the object to find, may be null Parameters: startIndex - the index to start searching at the index of the object within the array starting at the index,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(long[] array, long valueToFind)(Code) | | Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(long[] array, long valueToFind, int startIndex)(Code) | | Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.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
ArrayUtils.INDEX_NOT_FOUND (-1 ).
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the index to start searching at the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(int[] array, int valueToFind)(Code) | | Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(int[] array, int valueToFind, int startIndex)(Code) | | Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.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
ArrayUtils.INDEX_NOT_FOUND (-1 ).
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the index to start searching at the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(short[] array, short valueToFind)(Code) | | Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(short[] array, short valueToFind, int startIndex)(Code) | | Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.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
ArrayUtils.INDEX_NOT_FOUND (-1 ).
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the index to start searching at the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(char[] array, char valueToFind)(Code) | | Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input since: 2.1 |
indexOf | public static int indexOf(char[] array, char valueToFind, int startIndex)(Code) | | Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.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
ArrayUtils.INDEX_NOT_FOUND (-1 ).
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the index to start searching at the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input since: 2.1 |
indexOf | public static int indexOf(byte[] array, byte valueToFind)(Code) | | Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(byte[] array, byte valueToFind, int startIndex)(Code) | | Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.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
ArrayUtils.INDEX_NOT_FOUND (-1 ).
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the index to start searching at the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(double[] array, double valueToFind)(Code) | | Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(double[] array, double valueToFind, double tolerance)(Code) | | 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
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find Parameters: tolerance - tolerance of the search the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(double[] array, double valueToFind, int startIndex)(Code) | | Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.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
ArrayUtils.INDEX_NOT_FOUND (-1 ).
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the index to start searching at the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(double[] array, double valueToFind, int startIndex, double tolerance)(Code) | | 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
ArrayUtils.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
ArrayUtils.INDEX_NOT_FOUND (-1 ).
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the index to start searching at Parameters: tolerance - tolerance of the search the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(float[] array, float valueToFind)(Code) | | Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(float[] array, float valueToFind, int startIndex)(Code) | | Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.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
ArrayUtils.INDEX_NOT_FOUND (-1 ).
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the index to start searching at the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(boolean[] array, boolean valueToFind)(Code) | | Finds the index of the given value in the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
indexOf | public static int indexOf(boolean[] array, boolean valueToFind, int startIndex)(Code) | | Finds the index of the given value in the array starting at the given index.
This method returns
ArrayUtils.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
ArrayUtils.INDEX_NOT_FOUND (-1 ).
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the index to start searching at the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
isEmpty | public static boolean isEmpty(Object[] array)(Code) | | Checks if an array of Objects is empty or null .
Parameters: array - the array to test true if the array is empty or null since: 2.1 |
isEmpty | public static boolean isEmpty(long[] array)(Code) | | Checks if an array of primitive longs is empty or null .
Parameters: array - the array to test true if the array is empty or null since: 2.1 |
isEmpty | public static boolean isEmpty(int[] array)(Code) | | Checks if an array of primitive ints is empty or null .
Parameters: array - the array to test true if the array is empty or null since: 2.1 |
isEmpty | public static boolean isEmpty(short[] array)(Code) | | Checks if an array of primitive shorts is empty or null .
Parameters: array - the array to test true if the array is empty or null since: 2.1 |
isEmpty | public static boolean isEmpty(char[] array)(Code) | | Checks if an array of primitive chars is empty or null .
Parameters: array - the array to test true if the array is empty or null since: 2.1 |
isEmpty | public static boolean isEmpty(byte[] array)(Code) | | Checks if an array of primitive bytes is empty or null .
Parameters: array - the array to test true if the array is empty or null since: 2.1 |
isEmpty | public static boolean isEmpty(double[] array)(Code) | | Checks if an array of primitive doubles is empty or null .
Parameters: array - the array to test true if the array is empty or null since: 2.1 |
isEmpty | public static boolean isEmpty(float[] array)(Code) | | Checks if an array of primitive floats is empty or null .
Parameters: array - the array to test true if the array is empty or null since: 2.1 |
isEmpty | public static boolean isEmpty(boolean[] array)(Code) | | Checks if an array of primitive booleans is empty or null .
Parameters: array - the array to test true if the array is empty or null since: 2.1 |
isEquals | public static boolean isEquals(Object array1, Object array2)(Code) | | Compares two arrays, using equals(), handling multi-dimensional arrays
correctly.
Multi-dimensional primitive arrays are also handled correctly by this method.
Parameters: array1 - the left hand array to compare, may be null Parameters: array2 - the right hand array to compare, may be null true if the arrays are equal |
isSameLength | public static boolean isSameLength(Object[] array1, Object[] array2)(Code) | | Checks whether two arrays are the same length, treating
null arrays as length 0 .
Any multi-dimensional aspects of the arrays are ignored.
Parameters: array1 - the first array, may be null Parameters: array2 - the second array, may be null true if length of arrays matches, treatingnull as an empty array |
isSameLength | public static boolean isSameLength(long[] array1, long[] array2)(Code) | | Checks whether two arrays are the same length, treating
null arrays as length 0 .
Parameters: array1 - the first array, may be null Parameters: array2 - the second array, may be null true if length of arrays matches, treatingnull as an empty array |
isSameLength | public static boolean isSameLength(int[] array1, int[] array2)(Code) | | Checks whether two arrays are the same length, treating
null arrays as length 0 .
Parameters: array1 - the first array, may be null Parameters: array2 - the second array, may be null true if length of arrays matches, treatingnull as an empty array |
isSameLength | public static boolean isSameLength(short[] array1, short[] array2)(Code) | | Checks whether two arrays are the same length, treating
null arrays as length 0 .
Parameters: array1 - the first array, may be null Parameters: array2 - the second array, may be null true if length of arrays matches, treatingnull as an empty array |
isSameLength | public static boolean isSameLength(char[] array1, char[] array2)(Code) | | Checks whether two arrays are the same length, treating
null arrays as length 0 .
Parameters: array1 - the first array, may be null Parameters: array2 - the second array, may be null true if length of arrays matches, treatingnull as an empty array |
isSameLength | public static boolean isSameLength(byte[] array1, byte[] array2)(Code) | | Checks whether two arrays are the same length, treating
null arrays as length 0 .
Parameters: array1 - the first array, may be null Parameters: array2 - the second array, may be null true if length of arrays matches, treatingnull as an empty array |
isSameLength | public static boolean isSameLength(double[] array1, double[] array2)(Code) | | Checks whether two arrays are the same length, treating
null arrays as length 0 .
Parameters: array1 - the first array, may be null Parameters: array2 - the second array, may be null true if length of arrays matches, treatingnull as an empty array |
isSameLength | public static boolean isSameLength(float[] array1, float[] array2)(Code) | | Checks whether two arrays are the same length, treating
null arrays as length 0 .
Parameters: array1 - the first array, may be null Parameters: array2 - the second array, may be null true if length of arrays matches, treatingnull as an empty array |
isSameLength | public static boolean isSameLength(boolean[] array1, boolean[] array2)(Code) | | Checks whether two arrays are the same length, treating
null arrays as length 0 .
Parameters: array1 - the first array, may be null Parameters: array2 - the second array, may be null true if length of arrays matches, treatingnull as an empty array |
isSameType | public static boolean isSameType(Object array1, Object array2)(Code) | | Checks whether two arrays are the same type taking into account
multi-dimensional arrays.
Parameters: array1 - the first array, must not be null Parameters: array2 - the second array, must not be null true if type of arrays matches throws: IllegalArgumentException - if either array is null |
lastIndexOf | public static int lastIndexOf(Object[] array, Object objectToFind)(Code) | | Finds the last index of the given object within the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to travers backwords looking for the object, may be null Parameters: objectToFind - the object to find, may be null the last index of the object within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(Object[] array, Object objectToFind, int startIndex)(Code) | | Finds the last index of the given object in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). A startIndex larger than
the array length will search from the end of the array.
Parameters: array - the array to traverse for looking for the object, may be null Parameters: objectToFind - the object to find, may be null Parameters: startIndex - the start index to travers backwards from the last index of the object within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(long[] array, long valueToFind)(Code) | | Finds the last index of the given value within the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to travers backwords looking for the object, may be null Parameters: valueToFind - the object to find the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(long[] array, long valueToFind, int startIndex)(Code) | | Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). A startIndex larger than the
array length will search from the end of the array.
Parameters: array - the array to traverse for looking for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the start index to travers backwards from the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(int[] array, int valueToFind)(Code) | | Finds the last index of the given value within the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to travers backwords looking for the object, may be null Parameters: valueToFind - the object to find the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(int[] array, int valueToFind, int startIndex)(Code) | | Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). A startIndex larger than the
array length will search from the end of the array.
Parameters: array - the array to traverse for looking for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the start index to travers backwards from the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(short[] array, short valueToFind)(Code) | | Finds the last index of the given value within the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to travers backwords looking for the object, may be null Parameters: valueToFind - the object to find the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(short[] array, short valueToFind, int startIndex)(Code) | | Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). A startIndex larger than the
array length will search from the end of the array.
Parameters: array - the array to traverse for looking for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the start index to travers backwards from the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(char[] array, char valueToFind)(Code) | | Finds the last index of the given value within the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to travers backwords looking for the object, may be null Parameters: valueToFind - the object to find the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input since: 2.1 |
lastIndexOf | public static int lastIndexOf(char[] array, char valueToFind, int startIndex)(Code) | | Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). A startIndex larger than the
array length will search from the end of the array.
Parameters: array - the array to traverse for looking for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the start index to travers backwards from the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input since: 2.1 |
lastIndexOf | public static int lastIndexOf(byte[] array, byte valueToFind)(Code) | | Finds the last index of the given value within the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to travers backwords looking for the object, may be null Parameters: valueToFind - the object to find the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(byte[] array, byte valueToFind, int startIndex)(Code) | | Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). A startIndex larger than the
array length will search from the end of the array.
Parameters: array - the array to traverse for looking for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the start index to travers backwards from the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(double[] array, double valueToFind)(Code) | | Finds the last index of the given value within the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to travers backwords looking for the object, may be null Parameters: valueToFind - the object to find the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(double[] array, double valueToFind, double tolerance)(Code) | | 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
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to search through for the object, may be null Parameters: valueToFind - the value to find Parameters: tolerance - tolerance of the search the index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(double[] array, double valueToFind, int startIndex)(Code) | | Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). A startIndex larger than the
array length will search from the end of the array.
Parameters: array - the array to traverse for looking for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the start index to travers backwards from the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(double[] array, double valueToFind, int startIndex, double tolerance)(Code) | | 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
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). A startIndex larger than the
array length will search from the end of the array.
Parameters: array - the array to traverse for looking for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the start index to travers backwards from Parameters: tolerance - search for value within plus/minus this amount the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(float[] array, float valueToFind)(Code) | | Finds the last index of the given value within the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
Parameters: array - the array to travers backwords looking for the object, may be null Parameters: valueToFind - the object to find the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(float[] array, float valueToFind, int startIndex)(Code) | | Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). A startIndex larger than the
array length will search from the end of the array.
Parameters: array - the array to traverse for looking for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the start index to travers backwards from the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(boolean[] array, boolean valueToFind)(Code) | | Finds the last index of the given value within the array.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) if
null array input.
Parameters: array - the array to travers backwords looking for the object, may be null Parameters: valueToFind - the object to find the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
lastIndexOf | public static int lastIndexOf(boolean[] array, boolean valueToFind, int startIndex)(Code) | | Finds the last index of the given value in the array starting at the given index.
This method returns
ArrayUtils.INDEX_NOT_FOUND (-1 ) for a null input array.
A negative startIndex will return
ArrayUtils.INDEX_NOT_FOUND (-1 ). A startIndex larger than
the array length will search from the end of the array.
Parameters: array - the array to traverse for looking for the object, may be null Parameters: valueToFind - the value to find Parameters: startIndex - the start index to travers backwards from the last index of the value within the array,ArrayUtils.INDEX_NOT_FOUND (-1 ) if not found or null array input |
remove | public static Object[] remove(Object[] array, int index)(Code) | | Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , an IndexOutOfBoundsException
will be thrown, because in that case no valid index can be specified.
ArrayUtils.remove(["a"], 0) = []
ArrayUtils.remove(["a", "b"], 0) = ["b"]
ArrayUtils.remove(["a", "b"], 1) = ["a"]
ArrayUtils.remove(["a", "b", "c"], 1) = ["a", "c"]
Parameters: array - the array to remove the element from, may not be null Parameters: index - the position of the element to be removed A new array containing the existing elements except the elementat the specified position. throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= array.length), or if the array is null . since: 2.1 |
remove | public static boolean[] remove(boolean[] array, int index)(Code) | | Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , an IndexOutOfBoundsException
will be thrown, because in that case no valid index can be specified.
ArrayUtils.remove([true], 0) = []
ArrayUtils.remove([true, false], 0) = [false]
ArrayUtils.remove([true, false], 1) = [true]
ArrayUtils.remove([true, true, false], 1) = [true, false]
Parameters: array - the array to remove the element from, may not be null Parameters: index - the position of the element to be removed A new array containing the existing elements except the elementat the specified position. throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= array.length), or if the array is null . since: 2.1 |
remove | public static byte[] remove(byte[] array, int index)(Code) | | Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , an IndexOutOfBoundsException
will be thrown, because in that case no valid index can be specified.
ArrayUtils.remove([1], 0) = []
ArrayUtils.remove([1, 0], 0) = [0]
ArrayUtils.remove([1, 0], 1) = [1]
ArrayUtils.remove([1, 0, 1], 1) = [1, 1]
Parameters: array - the array to remove the element from, may not be null Parameters: index - the position of the element to be removed A new array containing the existing elements except the elementat the specified position. throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= array.length), or if the array is null . since: 2.1 |
remove | public static char[] remove(char[] array, int index)(Code) | | Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , an IndexOutOfBoundsException
will be thrown, because in that case no valid index can be specified.
ArrayUtils.remove(['a'], 0) = []
ArrayUtils.remove(['a', 'b'], 0) = ['b']
ArrayUtils.remove(['a', 'b'], 1) = ['a']
ArrayUtils.remove(['a', 'b', 'c'], 1) = ['a', 'c']
Parameters: array - the array to remove the element from, may not be null Parameters: index - the position of the element to be removed A new array containing the existing elements except the elementat the specified position. throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= array.length), or if the array is null . since: 2.1 |
remove | public static double[] remove(double[] array, int index)(Code) | | Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , an IndexOutOfBoundsException
will be thrown, because in that case no valid index can be specified.
ArrayUtils.remove([1.1], 0) = []
ArrayUtils.remove([2.5, 6.0], 0) = [6.0]
ArrayUtils.remove([2.5, 6.0], 1) = [2.5]
ArrayUtils.remove([2.5, 6.0, 3.8], 1) = [2.5, 3.8]
Parameters: array - the array to remove the element from, may not be null Parameters: index - the position of the element to be removed A new array containing the existing elements except the elementat the specified position. throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= array.length), or if the array is null . since: 2.1 |
remove | public static float[] remove(float[] array, int index)(Code) | | Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , an IndexOutOfBoundsException
will be thrown, because in that case no valid index can be specified.
ArrayUtils.remove([1.1], 0) = []
ArrayUtils.remove([2.5, 6.0], 0) = [6.0]
ArrayUtils.remove([2.5, 6.0], 1) = [2.5]
ArrayUtils.remove([2.5, 6.0, 3.8], 1) = [2.5, 3.8]
Parameters: array - the array to remove the element from, may not be null Parameters: index - the position of the element to be removed A new array containing the existing elements except the elementat the specified position. throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= array.length), or if the array is null . since: 2.1 |
remove | public static int[] remove(int[] array, int index)(Code) | | Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , an IndexOutOfBoundsException
will be thrown, because in that case no valid index can be specified.
ArrayUtils.remove([1], 0) = []
ArrayUtils.remove([2, 6], 0) = [6]
ArrayUtils.remove([2, 6], 1) = [2]
ArrayUtils.remove([2, 6, 3], 1) = [2, 3]
Parameters: array - the array to remove the element from, may not be null Parameters: index - the position of the element to be removed A new array containing the existing elements except the elementat the specified position. throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= array.length), or if the array is null . since: 2.1 |
remove | public static long[] remove(long[] array, int index)(Code) | | Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , an IndexOutOfBoundsException
will be thrown, because in that case no valid index can be specified.
ArrayUtils.remove([1], 0) = []
ArrayUtils.remove([2, 6], 0) = [6]
ArrayUtils.remove([2, 6], 1) = [2]
ArrayUtils.remove([2, 6, 3], 1) = [2, 3]
Parameters: array - the array to remove the element from, may not be null Parameters: index - the position of the element to be removed A new array containing the existing elements except the elementat the specified position. throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= array.length), or if the array is null . since: 2.1 |
remove | public static short[] remove(short[] array, int index)(Code) | | Removes the element at the specified position from the specified array.
All subsequent elements are shifted to the left (substracts one from
their indices).
This method returns a new array with the same elements of the input
array except the element on the specified position. The component
type of the returned array is always the same as that of the input
array.
If the input array is null , an IndexOutOfBoundsException
will be thrown, because in that case no valid index can be specified.
ArrayUtils.remove([1], 0) = []
ArrayUtils.remove([2, 6], 0) = [6]
ArrayUtils.remove([2, 6], 1) = [2]
ArrayUtils.remove([2, 6, 3], 1) = [2, 3]
Parameters: array - the array to remove the element from, may not be null Parameters: index - the position of the element to be removed A new array containing the existing elements except the elementat the specified position. throws: IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= array.length), or if the array is null . since: 2.1 |
removeElement | public static Object[] removeElement(Object[] array, Object element)(Code) | | Removes the first occurrence of the specified element from the
specified array. All subsequent elements are shifted to the left
(substracts one from their indices). If the array doesn't contains
such an element, no elements are removed from the array.
This method returns a new array with the same elements of the input
array except the first occurrence of the specified element. The component
type of the returned array is always the same as that of the input
array.
ArrayUtils.removeElement(null, "a") = null
ArrayUtils.removeElement([], "a") = []
ArrayUtils.removeElement(["a"], "b") = ["a"]
ArrayUtils.removeElement(["a", "b"], "a") = ["b"]
ArrayUtils.removeElement(["a", "b", "a"], "a") = ["b", "a"]
Parameters: array - the array to remove the element from, may be null Parameters: element - the element to be removed A new array containing the existing elements except the firstoccurrence of the specified element. since: 2.1 |
removeElement | public static boolean[] removeElement(boolean[] array, boolean element)(Code) | | Removes the first occurrence of the specified element from the
specified array. All subsequent elements are shifted to the left
(substracts one from their indices). If the array doesn't contains
such an element, no elements are removed from the array.
This method returns a new array with the same elements of the input
array except the first occurrence of the specified element. The component
type of the returned array is always the same as that of the input
array.
ArrayUtils.removeElement(null, true) = null
ArrayUtils.removeElement([], true) = []
ArrayUtils.removeElement([true], false) = [true]
ArrayUtils.removeElement([true, false], false) = [true]
ArrayUtils.removeElement([true, false, true], true) = [false, true]
Parameters: array - the array to remove the element from, may be null Parameters: element - the element to be removed A new array containing the existing elements except the firstoccurrence of the specified element. since: 2.1 |
removeElement | public static byte[] removeElement(byte[] array, byte element)(Code) | | Removes the first occurrence of the specified element from the
specified array. All subsequent elements are shifted to the left
(substracts one from their indices). If the array doesn't contains
such an element, no elements are removed from the array.
This method returns a new array with the same elements of the input
array except the first occurrence of the specified element. The component
type of the returned array is always the same as that of the input
array.
ArrayUtils.removeElement(null, 1) = null
ArrayUtils.removeElement([], 1) = []
ArrayUtils.removeElement([1], 0) = [1]
ArrayUtils.removeElement([1, 0], 0) = [1]
ArrayUtils.removeElement([1, 0, 1], 1) = [0, 1]
Parameters: array - the array to remove the element from, may be null Parameters: element - the element to be removed A new array containing the existing elements except the firstoccurrence of the specified element. since: 2.1 |
removeElement | public static char[] removeElement(char[] array, char element)(Code) | | Removes the first occurrence of the specified element from the
specified array. All subsequent elements are shifted to the left
(substracts one from their indices). If the array doesn't contains
such an element, no elements are removed from the array.
This method returns a new array with the same elements of the input
array except the first occurrence of the specified element. The component
type of the returned array is always the same as that of the input
array.
ArrayUtils.removeElement(null, 'a') = null
ArrayUtils.removeElement([], 'a') = []
ArrayUtils.removeElement(['a'], 'b') = ['a']
ArrayUtils.removeElement(['a', 'b'], 'a') = ['b']
ArrayUtils.removeElement(['a', 'b', 'a'], 'a') = ['b', 'a']
Parameters: array - the array to remove the element from, may be null Parameters: element - the element to be removed A new array containing the existing elements except the firstoccurrence of the specified element. since: 2.1 |
removeElement | public static double[] removeElement(double[] array, double element)(Code) | | Removes the first occurrence of the specified element from the
specified array. All subsequent elements are shifted to the left
(substracts one from their indices). If the array doesn't contains
such an element, no elements are removed from the array.
This method returns a new array with the same elements of the input
array except the first occurrence of the specified element. The component
type of the returned array is always the same as that of the input
array.
ArrayUtils.removeElement(null, 1.1) = null
ArrayUtils.removeElement([], 1.1) = []
ArrayUtils.removeElement([1.1], 1.2) = [1.1]
ArrayUtils.removeElement([1.1, 2.3], 1.1) = [2.3]
ArrayUtils.removeElement([1.1, 2.3, 1.1], 1.1) = [2.3, 1.1]
Parameters: array - the array to remove the element from, may be null Parameters: element - the element to be removed A new array containing the existing elements except the firstoccurrence of the specified element. since: 2.1 |
removeElement | public static float[] removeElement(float[] array, float element)(Code) | | Removes the first occurrence of the specified element from the
specified array. All subsequent elements are shifted to the left
(substracts one from their indices). If the array doesn't contains
such an element, no elements are removed from the array.
This method returns a new array with the same elements of the input
array except the first occurrence of the specified element. The component
type of the returned array is always the same as that of the input
array.
ArrayUtils.removeElement(null, 1.1) = null
ArrayUtils.removeElement([], 1.1) = []
ArrayUtils.removeElement([1.1], 1.2) = [1.1]
ArrayUtils.removeElement([1.1, 2.3], 1.1) = [2.3]
ArrayUtils.removeElement([1.1, 2.3, 1.1], 1.1) = [2.3, 1.1]
Parameters: array - the array to remove the element from, may be null Parameters: element - the element to be removed A new array containing the existing elements except the firstoccurrence of the specified element. since: 2.1 |
removeElement | public static int[] removeElement(int[] array, int element)(Code) | | Removes the first occurrence of the specified element from the
specified array. All subsequent elements are shifted to the left
(substracts one from their indices). If the array doesn't contains
such an element, no elements are removed from the array.
This method returns a new array with the same elements of the input
array except the first occurrence of the specified element. The component
type of the returned array is always the same as that of the input
array.
ArrayUtils.removeElement(null, 1) = null
ArrayUtils.removeElement([], 1) = []
ArrayUtils.removeElement([1], 2) = [1]
ArrayUtils.removeElement([1, 3], 1) = [3]
ArrayUtils.removeElement([1, 3, 1], 1) = [3, 1]
Parameters: array - the array to remove the element from, may be null Parameters: element - the element to be removed A new array containing the existing elements except the firstoccurrence of the specified element. since: 2.1 |
removeElement | public static long[] removeElement(long[] array, long element)(Code) | | Removes the first occurrence of the specified element from the
specified array. All subsequent elements are shifted to the left
(substracts one from their indices). If the array doesn't contains
such an element, no elements are removed from the array.
This method returns a new array with the same elements of the input
array except the first occurrence of the specified element. The component
type of the returned array is always the same as that of the input
array.
ArrayUtils.removeElement(null, 1) = null
ArrayUtils.removeElement([], 1) = []
ArrayUtils.removeElement([1], 2) = [1]
ArrayUtils.removeElement([1, 3], 1) = [3]
ArrayUtils.removeElement([1, 3, 1], 1) = [3, 1]
Parameters: array - the array to remove the element from, may be null Parameters: element - the element to be removed A new array containing the existing elements except the firstoccurrence of the specified element. since: 2.1 |
removeElement | public static short[] removeElement(short[] array, short element)(Code) | | Removes the first occurrence of the specified element from the
specified array. All subsequent elements are shifted to the left
(substracts one from their indices). If the array doesn't contains
such an element, no elements are removed from the array.
This method returns a new array with the same elements of the input
array except the first occurrence of the specified element. The component
type of the returned array is always the same as that of the input
array.
ArrayUtils.removeElement(null, 1) = null
ArrayUtils.removeElement([], 1) = []
ArrayUtils.removeElement([1], 2) = [1]
ArrayUtils.removeElement([1, 3], 1) = [3]
ArrayUtils.removeElement([1, 3, 1], 1) = [3, 1]
Parameters: array - the array to remove the element from, may be null Parameters: element - the element to be removed A new array containing the existing elements except the firstoccurrence of the specified element. since: 2.1 |
reverse | public static void reverse(Object[] array)(Code) | | Reverses the order of the given array.
There is no special handling for multi-dimensional arrays.
This method does nothing for a null input array.
Parameters: array - the array to reverse, may be null |
reverse | public static void reverse(long[] array)(Code) | | Reverses the order of the given array.
This method does nothing for a null input array.
Parameters: array - the array to reverse, may be null |
reverse | public static void reverse(int[] array)(Code) | | Reverses the order of the given array.
This method does nothing for a null input array.
Parameters: array - the array to reverse, may be null |
reverse | public static void reverse(short[] array)(Code) | | Reverses the order of the given array.
This method does nothing for a null input array.
Parameters: array - the array to reverse, may be null |
reverse | public static void reverse(char[] array)(Code) | | Reverses the order of the given array.
This method does nothing for a null input array.
Parameters: array - the array to reverse, may be null |
reverse | public static void reverse(byte[] array)(Code) | | Reverses the order of the given array.
This method does nothing for a null input array.
Parameters: array - the array to reverse, may be null |
reverse | public static void reverse(double[] array)(Code) | | Reverses the order of the given array.
This method does nothing for a null input array.
Parameters: array - the array to reverse, may be null |
reverse | public static void reverse(float[] array)(Code) | | Reverses the order of the given array.
This method does nothing for a null input array.
Parameters: array - the array to reverse, may be null |
reverse | public static void reverse(boolean[] array)(Code) | | Reverses the order of the given array.
This method does nothing for a null input array.
Parameters: array - the array to reverse, may be null |
subarray | public static Object[] subarray(Object[] array, int startIndexInclusive, int endIndexExclusive)(Code) | | Produces a new array containing the elements between
the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
The component type of the subarray is always the same as
that of the input array. Thus, if the input is an array of type
Date , the following usage is envisaged:
Date[] someDates = (Date[])ArrayUtils.subarray(allDates, 2, 5);
Parameters: array - the array Parameters: startIndexInclusive - the starting index. Undervalue (<0)is promoted to 0, overvalue (>array.length) resultsin an empty array. Parameters: endIndexExclusive - elements up to endIndex-1 are present in thereturned subarray. Undervalue (< startIndex) producesempty array, overvalue (>array.length) is demoted toarray length. a new array containing the elements betweenthe start and end indices. since: 2.1 |
subarray | public static long[] subarray(long[] array, int startIndexInclusive, int endIndexExclusive)(Code) | | Produces a new long array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. Undervalue (<0)is promoted to 0, overvalue (>array.length) resultsin an empty array. Parameters: endIndexExclusive - elements up to endIndex-1 are present in thereturned subarray. Undervalue (< startIndex) producesempty array, overvalue (>array.length) is demoted toarray length. a new array containing the elements betweenthe start and end indices. since: 2.1 |
subarray | public static int[] subarray(int[] array, int startIndexInclusive, int endIndexExclusive)(Code) | | Produces a new int array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. Undervalue (<0)is promoted to 0, overvalue (>array.length) resultsin an empty array. Parameters: endIndexExclusive - elements up to endIndex-1 are present in thereturned subarray. Undervalue (< startIndex) producesempty array, overvalue (>array.length) is demoted toarray length. a new array containing the elements betweenthe start and end indices. since: 2.1 |
subarray | public static short[] subarray(short[] array, int startIndexInclusive, int endIndexExclusive)(Code) | | Produces a new short array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. Undervalue (<0)is promoted to 0, overvalue (>array.length) resultsin an empty array. Parameters: endIndexExclusive - elements up to endIndex-1 are present in thereturned subarray. Undervalue (< startIndex) producesempty array, overvalue (>array.length) is demoted toarray length. a new array containing the elements betweenthe start and end indices. since: 2.1 |
subarray | public static char[] subarray(char[] array, int startIndexInclusive, int endIndexExclusive)(Code) | | Produces a new char array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. Undervalue (<0)is promoted to 0, overvalue (>array.length) resultsin an empty array. Parameters: endIndexExclusive - elements up to endIndex-1 are present in thereturned subarray. Undervalue (< startIndex) producesempty array, overvalue (>array.length) is demoted toarray length. a new array containing the elements betweenthe start and end indices. since: 2.1 |
subarray | public static byte[] subarray(byte[] array, int startIndexInclusive, int endIndexExclusive)(Code) | | Produces a new byte array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. Undervalue (<0)is promoted to 0, overvalue (>array.length) resultsin an empty array. Parameters: endIndexExclusive - elements up to endIndex-1 are present in thereturned subarray. Undervalue (< startIndex) producesempty array, overvalue (>array.length) is demoted toarray length. a new array containing the elements betweenthe start and end indices. since: 2.1 |
subarray | public static double[] subarray(double[] array, int startIndexInclusive, int endIndexExclusive)(Code) | | Produces a new double array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. Undervalue (<0)is promoted to 0, overvalue (>array.length) resultsin an empty array. Parameters: endIndexExclusive - elements up to endIndex-1 are present in thereturned subarray. Undervalue (< startIndex) producesempty array, overvalue (>array.length) is demoted toarray length. a new array containing the elements betweenthe start and end indices. since: 2.1 |
subarray | public static float[] subarray(float[] array, int startIndexInclusive, int endIndexExclusive)(Code) | | Produces a new float array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. Undervalue (<0)is promoted to 0, overvalue (>array.length) resultsin an empty array. Parameters: endIndexExclusive - elements up to endIndex-1 are present in thereturned subarray. Undervalue (< startIndex) producesempty array, overvalue (>array.length) is demoted toarray length. a new array containing the elements betweenthe start and end indices. since: 2.1 |
subarray | public static boolean[] subarray(boolean[] array, int startIndexInclusive, int endIndexExclusive)(Code) | | Produces a new boolean array containing the elements
between the start and end indices.
The start index is inclusive, the end index exclusive.
Null array input produces null output.
Parameters: array - the array Parameters: startIndexInclusive - the starting index. Undervalue (<0)is promoted to 0, overvalue (>array.length) resultsin an empty array. Parameters: endIndexExclusive - elements up to endIndex-1 are present in thereturned subarray. Undervalue (< startIndex) producesempty array, overvalue (>array.length) is demoted toarray length. a new array containing the elements betweenthe start and end indices. since: 2.1 |
toMap | public static Map toMap(Object[] array)(Code) | | Converts the given array into a
java.util.Map . Each element of the array
must be either a
java.util.Map.Entry or an Array, containing at least two
elements, where the first element is used as key and the second as
value.
This method can be used to initialize:
// Create a Map mapping colors.
Map colorMap = MapUtils.toMap(new String[][] {{
{"RED", "#FF0000"},
{"GREEN", "#00FF00"},
{"BLUE", "#0000FF"}});
This method returns null for a null input array.
Parameters: array - an array whose elements are either a java.util.Map.Entry oran Array containing at least two elements, may be null a Map that was created from the array throws: IllegalArgumentException - if one element of this Array isitself an Array containing less then two elements throws: IllegalArgumentException - if the array contains elements otherthan java.util.Map.Entry and an Array |
toObject | public static Character[] toObject(char[] array)(Code) | | Converts an array of primitive chars to objects.
This method returns null for a null input array.
Parameters: array - a char array a Character array, null if null array input |
toObject | public static Long[] toObject(long[] array)(Code) | | Converts an array of primitive longs to objects.
This method returns null for a null input array.
Parameters: array - a long array a Long array, null if null array input |
toObject | public static Integer[] toObject(int[] array)(Code) | | Converts an array of primitive ints to objects.
This method returns null for a null input array.
Parameters: array - an int array an Integer array, null if null array input |
toObject | public static Short[] toObject(short[] array)(Code) | | Converts an array of primitive shorts to objects.
This method returns null for a null input array.
Parameters: array - a short array a Short array, null if null array input |
toObject | public static Byte[] toObject(byte[] array)(Code) | | Converts an array of primitive bytes to objects.
This method returns null for a null input array.
Parameters: array - a byte array a Byte array, null if null array input |
toObject | public static Double[] toObject(double[] array)(Code) | | Converts an array of primitive doubles to objects.
This method returns null for a null input array.
Parameters: array - a double array a Double array, null if null array input |
toObject | public static Float[] toObject(float[] array)(Code) | | Converts an array of primitive floats to objects.
This method returns null for a null input array.
Parameters: array - a float array a Float array, null if null array input |
toObject | public static Boolean[] toObject(boolean[] array)(Code) | | Converts an array of primitive booleans to objects.
This method returns null for a null input array.
Parameters: array - a boolean array a Boolean array, null if null array input |
toPrimitive | public static char[] toPrimitive(Character[] array)(Code) | | Converts an array of object Characters to primitives.
This method returns null for a null input array.
Parameters: array - a Character array, may be null a char array, null if null array input throws: NullPointerException - if array content is null |
toPrimitive | public static char[] toPrimitive(Character[] array, char valueForNull)(Code) | | Converts an array of object Character to primitives handling null .
This method returns null for a null input array.
Parameters: array - a Character array, may be null Parameters: valueForNull - the value to insert if null found a char array, null if null array input |
toPrimitive | public static long[] toPrimitive(Long[] array)(Code) | | Converts an array of object Longs to primitives.
This method returns null for a null input array.
Parameters: array - a Long array, may be null a long array, null if null array input throws: NullPointerException - if array content is null |
toPrimitive | public static long[] toPrimitive(Long[] array, long valueForNull)(Code) | | Converts an array of object Long to primitives handling null .
This method returns null for a null input array.
Parameters: array - a Long array, may be null Parameters: valueForNull - the value to insert if null found a long array, null if null array input |
toPrimitive | public static int[] toPrimitive(Integer[] array)(Code) | | Converts an array of object Integers to primitives.
This method returns null for a null input array.
Parameters: array - a Integer array, may be null an int array, null if null array input throws: NullPointerException - if array content is null |
toPrimitive | public static int[] toPrimitive(Integer[] array, int valueForNull)(Code) | | Converts an array of object Integer to primitives handling null .
This method returns null for a null input array.
Parameters: array - a Integer array, may be null Parameters: valueForNull - the value to insert if null found an int array, null if null array input |
toPrimitive | public static short[] toPrimitive(Short[] array)(Code) | | Converts an array of object Shorts to primitives.
This method returns null for a null input array.
Parameters: array - a Short array, may be null a byte array, null if null array input throws: NullPointerException - if array content is null |
toPrimitive | public static short[] toPrimitive(Short[] array, short valueForNull)(Code) | | Converts an array of object Short to primitives handling null .
This method returns null for a null input array.
Parameters: array - a Short array, may be null Parameters: valueForNull - the value to insert if null found a byte array, null if null array input |
toPrimitive | public static byte[] toPrimitive(Byte[] array)(Code) | | Converts an array of object Bytes to primitives.
This method returns null for a null input array.
Parameters: array - a Byte array, may be null a byte array, null if null array input throws: NullPointerException - if array content is null |
toPrimitive | public static byte[] toPrimitive(Byte[] array, byte valueForNull)(Code) | | Converts an array of object Bytes to primitives handling null .
This method returns null for a null input array.
Parameters: array - a Byte array, may be null Parameters: valueForNull - the value to insert if null found a byte array, null if null array input |
toPrimitive | public static double[] toPrimitive(Double[] array)(Code) | | Converts an array of object Doubles to primitives.
This method returns null for a null input array.
Parameters: array - a Double array, may be null a double array, null if null array input throws: NullPointerException - if array content is null |
toPrimitive | public static double[] toPrimitive(Double[] array, double valueForNull)(Code) | | Converts an array of object Doubles to primitives handling null .
This method returns null for a null input array.
Parameters: array - a Double array, may be null Parameters: valueForNull - the value to insert if null found a double array, null if null array input |
toPrimitive | public static float[] toPrimitive(Float[] array)(Code) | | Converts an array of object Floats to primitives.
This method returns null for a null input array.
Parameters: array - a Float array, may be null a float array, null if null array input throws: NullPointerException - if array content is null |
toPrimitive | public static float[] toPrimitive(Float[] array, float valueForNull)(Code) | | Converts an array of object Floats to primitives handling null .
This method returns null for a null input array.
Parameters: array - a Float array, may be null Parameters: valueForNull - the value to insert if null found a float array, null if null array input |
toPrimitive | public static boolean[] toPrimitive(Boolean[] array)(Code) | | Converts an array of object Booleans to primitives.
This method returns null for a null input array.
Parameters: array - a Boolean array, may be null a boolean array, null if null array input throws: NullPointerException - if array content is null |
toPrimitive | public static boolean[] toPrimitive(Boolean[] array, boolean valueForNull)(Code) | | Converts an array of object Booleans to primitives handling null .
This method returns null for a null input array.
Parameters: array - a Boolean array, may be null Parameters: valueForNull - the value to insert if null found a boolean array, null if null array input |
toString | public static String toString(Object array)(Code) | | Outputs an array as a String, treating null as an empty array.
Multi-dimensional arrays are handled correctly, including
multi-dimensional primitive arrays.
The format is that of Java source code, for example {a,b} .
Parameters: array - the array to get a toString for, may be null a String representation of the array, '{}' if null array input |
toString | public static String toString(Object array, String stringIfNull)(Code) | | Outputs an array as a String handling null s.
Multi-dimensional arrays are handled correctly, including
multi-dimensional primitive arrays.
The format is that of Java source code, for example {a,b} .
Parameters: array - the array to get a toString for, may be null Parameters: stringIfNull - the String to return if the array is null a String representation of the array |
|
|