Class ArrayUtils
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 behavior.
 
#ThreadSafe#
- Since:
- 2.0
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final boolean[]An empty immutablebooleanarray.static final Boolean[]An empty immutableBooleanarray.static final byte[]An empty immutablebytearray.static final Byte[]An empty immutableBytearray.static final char[]An empty immutablechararray.static final Character[]An empty immutableCharacterarray.static final Class<?>[]An empty immutableClassarray.static final double[]An empty immutabledoublearray.static final Double[]An empty immutableDoublearray.static final Field[]An empty immutableFieldarray.static final float[]An empty immutablefloatarray.static final Float[]An empty immutableFloatarray.static final int[]An empty immutableintarray.static final Integer[]An empty immutableIntegerarray.static final long[]An empty immutablelongarray.static final Long[]An empty immutableLongarray.static final Method[]An empty immutableMethodarray.static final Object[]An empty immutableObjectarray.static final short[]An empty immutableshortarray.static final Short[]An empty immutableShortarray.static final String[]An empty immutableStringarray.static final Throwable[]An empty immutableThrowablearray.static final Type[]An empty immutableTypearray.static final intThe index value when an element is not found in a list or array:-1.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic boolean[]add(boolean[] array, boolean element) Copies the given array and adds the given element at the end of the new array.static boolean[]add(boolean[] array, int index, boolean element) Deprecated.this method has been superseded byinsert(int, boolean[], boolean...)and may be removed in a future release.static byte[]add(byte[] array, byte element) Copies the given array and adds the given element at the end of the new array.static byte[]add(byte[] array, int index, byte element) Deprecated.this method has been superseded byinsert(int, byte[], byte...)and may be removed in a future release.static char[]add(char[] array, char element) Copies the given array and adds the given element at the end of the new array.static char[]add(char[] array, int index, char element) Deprecated.this method has been superseded byinsert(int, char[], char...)and may be removed in a future release.static double[]add(double[] array, double element) Copies the given array and adds the given element at the end of the new array.static double[]add(double[] array, int index, double element) Deprecated.this method has been superseded byinsert(int, double[], double...)and may be removed in a future release.static float[]add(float[] array, float element) Copies the given array and adds the given element at the end of the new array.static float[]add(float[] array, int index, float element) Deprecated.this method has been superseded byinsert(int, float[], float...)and may be removed in a future release.static int[]add(int[] array, int element) Copies the given array and adds the given element at the end of the new array.static int[]add(int[] array, int index, int element) Deprecated.this method has been superseded byinsert(int, int[], int...)and may be removed in a future release.static long[]add(long[] array, int index, long element) Deprecated.this method has been superseded byinsert(int, long[], long...)and may be removed in a future release.static long[]add(long[] array, long element) Copies the given array and adds the given element at the end of the new array.static short[]add(short[] array, int index, short element) Deprecated.this method has been superseded byinsert(int, short[], short...)and may be removed in a future release.static short[]add(short[] array, short element) Copies the given array and adds the given element at the end of the new array.static <T> T[]add(T[] array, int index, T element) Deprecated.this method has been superseded byinsert(int, T[], T...)and may be removed in a future release.static <T> T[]add(T[] array, T element) Copies the given array and adds the given element at the end of the new array.static boolean[]addAll(boolean[] array1, boolean... array2) Adds all the elements of the given arrays into a new array.static byte[]addAll(byte[] array1, byte... array2) Adds all the elements of the given arrays into a new array.static char[]addAll(char[] array1, char... array2) Adds all the elements of the given arrays into a new array.static double[]addAll(double[] array1, double... array2) Adds all the elements of the given arrays into a new array.static float[]addAll(float[] array1, float... array2) Adds all the elements of the given arrays into a new array.static int[]addAll(int[] array1, int... array2) Adds all the elements of the given arrays into a new array.static long[]addAll(long[] array1, long... array2) Adds all the elements of the given arrays into a new array.static short[]addAll(short[] array1, short... array2) Adds all the elements of the given arrays into a new array.static <T> T[]addAll(T[] array1, T... array2) Adds all the elements of the given arrays into a new array.static boolean[]addFirst(boolean[] array, boolean element) Copies the given array and adds the given element at the beginning of the new array.static byte[]addFirst(byte[] array, byte element) Copies the given array and adds the given element at the beginning of the new array.static char[]addFirst(char[] array, char element) Copies the given array and adds the given element at the beginning of the new array.static double[]addFirst(double[] array, double element) Copies the given array and adds the given element at the beginning of the new array.static float[]addFirst(float[] array, float element) Copies the given array and adds the given element at the beginning of the new array.static int[]addFirst(int[] array, int element) Copies the given array and adds the given element at the beginning of the new array.static long[]addFirst(long[] array, long element) Copies the given array and adds the given element at the beginning of the new array.static short[]addFirst(short[] array, short element) Copies the given array and adds the given element at the beginning of the new array.static <T> T[]addFirst(T[] array, T element) Copies the given array and adds the given element at the beginning of the new array.static <T> TA fluent version ofSystem.arraycopy(Object, int, Object, int, int)that returns the destination array.static <T> TA fluent version ofSystem.arraycopy(Object, int, Object, int, int)that returns the destination array.static <T> Tarraycopy(T source, int sourcePos, T dest, int destPos, int length) A fluent version ofSystem.arraycopy(Object, int, Object, int, int)that returns the destination array.static boolean[]clone(boolean[] array) Clones an array or returnsnull.static byte[]clone(byte[] array) Clones an array or returnsnull.static char[]clone(char[] array) Clones an array or returnsnull.static double[]clone(double[] array) Clones an array or returnsnull.static float[]clone(float[] array) Clones an array or returnsnull.static int[]clone(int[] array) Clones an array or returnsnull.static long[]clone(long[] array) Clones an array or returnsnull.static short[]clone(short[] array) Clones an array or returnsnull.static <T> T[]clone(T[] array) Shallow clones an array or returnsnull.static booleancontains(boolean[] array, boolean valueToFind) Checks if the value is in the given array.static booleancontains(byte[] array, byte valueToFind) Checks if the value is in the given array.static booleancontains(char[] array, char valueToFind) Checks if the value is in the given array.static booleancontains(double[] array, double valueToFind) Checks if the value is in the given array.static booleancontains(double[] array, double valueToFind, double tolerance) Checks if a value falling within the given tolerance is in the given array.static booleancontains(float[] array, float valueToFind) Checks if the value is in the given array.static booleancontains(int[] array, int valueToFind) Checks if the value is in the given array.static booleancontains(long[] array, long valueToFind) Checks if the value is in the given array.static booleancontains(short[] array, short valueToFind) Checks if the value is in the given array.static booleanChecks if the object is in the given array.static booleancontainsAny(Object[] array, Object... objectsToFind) Checks if any of the objects are in the given array.static <T> Tget(T[] array, int index) Gets the nTh element of an array or null if the index is out of bounds or the array is null.static <T> Tget(T[] array, int index, T defaultValue) Gets the nTh element of an array or a default value if the index is out of bounds.static <T> Class<T>getComponentType(T[] array) Gets an array's component type.static intReturns the length of the specified array.static intGets a hash code for an array handling multidimensional arrays correctly.static BitSetindexesOf(boolean[] array, boolean valueToFind) Finds the indices of the given value in the array.static BitSetindexesOf(boolean[] array, boolean valueToFind, int startIndex) Finds the indices of the given value in the array starting at the given index.static BitSetindexesOf(byte[] array, byte valueToFind) Finds the indices of the given value in the array.static BitSetindexesOf(byte[] array, byte valueToFind, int startIndex) Finds the indices of the given value in the array starting at the given index.static BitSetindexesOf(char[] array, char valueToFind) Finds the indices of the given value in the array.static BitSetindexesOf(char[] array, char valueToFind, int startIndex) Finds the indices of the given value in the array starting at the given index.static BitSetindexesOf(double[] array, double valueToFind) Finds the indices of the given value in the array.static BitSetindexesOf(double[] array, double valueToFind, double tolerance) Finds the indices of the given value within a given tolerance in the array.static BitSetindexesOf(double[] array, double valueToFind, int startIndex) Finds the indices of the given value in the array starting at the given index.static BitSetindexesOf(double[] array, double valueToFind, int startIndex, double tolerance) Finds the indices of the given value in the array starting at the given index.static BitSetindexesOf(float[] array, float valueToFind) Finds the indices of the given value in the array.static BitSetindexesOf(float[] array, float valueToFind, int startIndex) Finds the indices of the given value in the array starting at the given index.static BitSetindexesOf(int[] array, int valueToFind) Finds the indices of the given value in the array.static BitSetindexesOf(int[] array, int valueToFind, int startIndex) Finds the indices of the given value in the array starting at the given index.static BitSetindexesOf(long[] array, long valueToFind) Finds the indices of the given value in the array.static BitSetindexesOf(long[] array, long valueToFind, int startIndex) Finds the indices of the given value in the array starting at the given index.static BitSetindexesOf(short[] array, short valueToFind) Finds the indices of the given value in the array.static BitSetindexesOf(short[] array, short valueToFind, int startIndex) Finds the indices of the given value in the array starting at the given index.static BitSetFinds the indices of the given object in the array.static BitSetFinds the indices of the given object in the array starting at the given index.static intindexOf(boolean[] array, boolean valueToFind) Finds the index of the given value in the array.static intindexOf(boolean[] array, boolean valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.static intindexOf(byte[] array, byte valueToFind) Finds the index of the given value in the array.static intindexOf(byte[] array, byte valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.static intindexOf(char[] array, char valueToFind) Finds the index of the given value in the array.static intindexOf(char[] array, char valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.static intindexOf(double[] array, double valueToFind) Finds the index of the given value in the array.static intindexOf(double[] array, double valueToFind, double tolerance) Finds the index of the given value within a given tolerance in the array.static intindexOf(double[] array, double valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.static intindexOf(double[] array, double valueToFind, int startIndex, double tolerance) Finds the index of the given value in the array starting at the given index.static intindexOf(float[] array, float valueToFind) Finds the index of the given value in the array.static intindexOf(float[] array, float valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.static intindexOf(int[] array, int valueToFind) Finds the index of the given value in the array.static intindexOf(int[] array, int valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.static intindexOf(long[] array, long valueToFind) Finds the index of the given value in the array.static intindexOf(long[] array, long valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.static intindexOf(short[] array, short valueToFind) Finds the index of the given value in the array.static intindexOf(short[] array, short valueToFind, int startIndex) Finds the index of the given value in the array starting at the given index.static intFinds the index of the given object in the array.static intFinds the index of the given object in the array starting at the given index.static boolean[]insert(int index, boolean[] array, boolean... values) Inserts elements into an array at the given index (starting from zero).static byte[]insert(int index, byte[] array, byte... values) Inserts elements into an array at the given index (starting from zero).static char[]insert(int index, char[] array, char... values) Inserts elements into an array at the given index (starting from zero).static double[]insert(int index, double[] array, double... values) Inserts elements into an array at the given index (starting from zero).static float[]insert(int index, float[] array, float... values) Inserts elements into an array at the given index (starting from zero).static int[]insert(int index, int[] array, int... values) Inserts elements into an array at the given index (starting from zero).static long[]insert(int index, long[] array, long... values) Inserts elements into an array at the given index (starting from zero).static short[]insert(int index, short[] array, short... values) Inserts elements into an array at the given index (starting from zero).static <T> T[]insert(int index, T[] array, T... values) Inserts elements into an array at the given index (starting from zero).static <T> booleanisArrayIndexValid(T[] array, int index) Returns whether a given array can safely be accessed at the given index.static booleanisEmpty(boolean[] array) Checks if an array of primitive booleans is empty ornull.static booleanisEmpty(byte[] array) Checks if an array of primitive bytes is empty ornull.static booleanisEmpty(char[] array) Checks if an array of primitive chars is empty ornull.static booleanisEmpty(double[] array) Checks if an array of primitive doubles is empty ornull.static booleanisEmpty(float[] array) Checks if an array of primitive floats is empty ornull.static booleanisEmpty(int[] array) Checks if an array of primitive ints is empty ornull.static booleanisEmpty(long[] array) Checks if an array of primitive longs is empty ornull.static booleanisEmpty(short[] array) Checks if an array of primitive shorts is empty ornull.static booleanChecks if an array of Objects is empty ornull.static booleanDeprecated.this method has been replaced byjava.util.Objects.deepEquals(Object, Object)and will be removed from future releases.static booleanisNotEmpty(boolean[] array) Checks if an array of primitive booleans is not empty and notnull.static booleanisNotEmpty(byte[] array) Checks if an array of primitive bytes is not empty and notnull.static booleanisNotEmpty(char[] array) Checks if an array of primitive chars is not empty and notnull.static booleanisNotEmpty(double[] array) Checks if an array of primitive doubles is not empty and notnull.static booleanisNotEmpty(float[] array) Checks if an array of primitive floats is not empty and notnull.static booleanisNotEmpty(int[] array) Checks if an array of primitive ints is not empty and notnull.static booleanisNotEmpty(long[] array) Checks if an array of primitive longs is not empty and notnull.static booleanisNotEmpty(short[] array) Checks if an array of primitive shorts is not empty and notnull.static <T> booleanisNotEmpty(T[] array) Checks if an array of Objects is not empty and notnull.static booleanisSameLength(boolean[] array1, boolean[] array2) Checks whether two arrays are the same length, treatingnullarrays as length0.static booleanisSameLength(byte[] array1, byte[] array2) Checks whether two arrays are the same length, treatingnullarrays as length0.static booleanisSameLength(char[] array1, char[] array2) Checks whether two arrays are the same length, treatingnullarrays as length0.static booleanisSameLength(double[] array1, double[] array2) Checks whether two arrays are the same length, treatingnullarrays as length0.static booleanisSameLength(float[] array1, float[] array2) Checks whether two arrays are the same length, treatingnullarrays as length0.static booleanisSameLength(int[] array1, int[] array2) Checks whether two arrays are the same length, treatingnullarrays as length0.static booleanisSameLength(long[] array1, long[] array2) Checks whether two arrays are the same length, treatingnullarrays as length0.static booleanisSameLength(short[] array1, short[] array2) Checks whether two arrays are the same length, treatingnullarrays as length0.static booleanisSameLength(Object[] array1, Object[] array2) Checks whether two arrays are the same length, treatingnullarrays as length0.static booleanisSameLength(Object array1, Object array2) Checks whether two arrays are the same length, treatingnullarrays as length0.static booleanisSameType(Object array1, Object array2) Checks whether two arrays are the same type taking into account multidimensional arrays.static booleanisSorted(boolean[] array) This method checks whether the provided array is sorted according to natural ordering (falsebeforetrue).static booleanisSorted(byte[] array) Checks whether the provided array is sorted according to natural ordering.static booleanisSorted(char[] array) Checks whether the provided array is sorted according to natural ordering.static booleanisSorted(double[] array) This method checks whether the provided array is sorted according to natural ordering.static booleanisSorted(float[] array) This method checks whether the provided array is sorted according to natural ordering.static booleanisSorted(int[] array) This method checks whether the provided array is sorted according to natural ordering.static booleanisSorted(long[] array) This method checks whether the provided array is sorted according to natural ordering.static booleanisSorted(short[] array) This method checks whether the provided array is sorted according to natural ordering.static <T extends Comparable<? super T>>
 booleanisSorted(T[] array) This method checks whether the provided array is sorted according to the class'scompareTomethod.static <T> booleanisSorted(T[] array, Comparator<T> comparator) This method checks whether the provided array is sorted according to the providedComparator.static intlastIndexOf(boolean[] array, boolean valueToFind) Finds the last index of the given value within the array.static intlastIndexOf(boolean[] array, boolean valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.static intlastIndexOf(byte[] array, byte valueToFind) Finds the last index of the given value within the array.static intlastIndexOf(byte[] array, byte valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.static intlastIndexOf(char[] array, char valueToFind) Finds the last index of the given value within the array.static intlastIndexOf(char[] array, char valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.static intlastIndexOf(double[] array, double valueToFind) Finds the last index of the given value within the array.static intlastIndexOf(double[] array, double valueToFind, double tolerance) Finds the last index of the given value within a given tolerance in the array.static intlastIndexOf(double[] array, double valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.static intlastIndexOf(double[] array, double valueToFind, int startIndex, double tolerance) Finds the last index of the given value in the array starting at the given index.static intlastIndexOf(float[] array, float valueToFind) Finds the last index of the given value within the array.static intlastIndexOf(float[] array, float valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.static intlastIndexOf(int[] array, int valueToFind) Finds the last index of the given value within the array.static intlastIndexOf(int[] array, int valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.static intlastIndexOf(long[] array, long valueToFind) Finds the last index of the given value within the array.static intlastIndexOf(long[] array, long valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.static intlastIndexOf(short[] array, short valueToFind) Finds the last index of the given value within the array.static intlastIndexOf(short[] array, short valueToFind, int startIndex) Finds the last index of the given value in the array starting at the given index.static intlastIndexOf(Object[] array, Object objectToFind) Finds the last index of the given object within the array.static intlastIndexOf(Object[] array, Object objectToFind, int startIndex) Finds the last index of the given object in the array starting at the given index.static <T> T[]newInstance(Class<T> componentType, int length) Delegates toArray.newInstance(Class,int)using generics.static <T> T[]nullTo(T[] array, T[] defaultArray) Defensive programming technique to change anullreference to an empty one.static boolean[]nullToEmpty(boolean[] array) Defensive programming technique to change anullreference to an empty one.static byte[]nullToEmpty(byte[] array) Defensive programming technique to change anullreference to an empty one.static char[]nullToEmpty(char[] array) Defensive programming technique to change anullreference to an empty one.static double[]nullToEmpty(double[] array) Defensive programming technique to change anullreference to an empty one.static float[]nullToEmpty(float[] array) Defensive programming technique to change anullreference to an empty one.static int[]nullToEmpty(int[] array) Defensive programming technique to change anullreference to an empty one.static long[]nullToEmpty(long[] array) Defensive programming technique to change anullreference to an empty one.static short[]nullToEmpty(short[] array) Defensive programming technique to change anullreference to an empty one.static Boolean[]nullToEmpty(Boolean[] array) Defensive programming technique to change anullreference to an empty one.static Byte[]nullToEmpty(Byte[] array) Defensive programming technique to change anullreference to an empty one.static Character[]nullToEmpty(Character[] array) Defensive programming technique to change anullreference to an empty one.static Class<?>[]nullToEmpty(Class<?>[] array) Defensive programming technique to change anullreference to an empty one.static Double[]nullToEmpty(Double[] array) Defensive programming technique to change anullreference to an empty one.static Float[]nullToEmpty(Float[] array) Defensive programming technique to change anullreference to an empty one.static Integer[]nullToEmpty(Integer[] array) Defensive programming technique to change anullreference to an empty one.static Long[]nullToEmpty(Long[] array) Defensive programming technique to change anullreference to an empty one.static Object[]nullToEmpty(Object[] array) Defensive programming technique to change anullreference to an empty one.static Short[]nullToEmpty(Short[] array) Defensive programming technique to change anullreference to an empty one.static String[]nullToEmpty(String[] array) Defensive programming technique to change anullreference to an empty one.static <T> T[]nullToEmpty(T[] array, Class<T[]> type) Defensive programming technique to change anullreference to an empty one.static boolean[]remove(boolean[] array, int index) Removes the element at the specified position from the specified array.static byte[]remove(byte[] array, int index) Removes the element at the specified position from the specified array.static char[]remove(char[] array, int index) Removes the element at the specified position from the specified array.static double[]remove(double[] array, int index) Removes the element at the specified position from the specified array.static float[]remove(float[] array, int index) Removes the element at the specified position from the specified array.static int[]remove(int[] array, int index) Removes the element at the specified position from the specified array.static long[]remove(long[] array, int index) Removes the element at the specified position from the specified array.static short[]remove(short[] array, int index) Removes the element at the specified position from the specified array.static <T> T[]remove(T[] array, int index) Removes the element at the specified position from the specified array.static boolean[]removeAll(boolean[] array, int... indices) Removes the elements at the specified positions from the specified array.static byte[]removeAll(byte[] array, int... indices) Removes the elements at the specified positions from the specified array.static char[]removeAll(char[] array, int... indices) Removes the elements at the specified positions from the specified array.static double[]removeAll(double[] array, int... indices) Removes the elements at the specified positions from the specified array.static float[]removeAll(float[] array, int... indices) Removes the elements at the specified positions from the specified array.static int[]removeAll(int[] array, int... indices) Removes the elements at the specified positions from the specified array.static long[]removeAll(long[] array, int... indices) Removes the elements at the specified positions from the specified array.static short[]removeAll(short[] array, int... indices) Removes the elements at the specified positions from the specified array.static <T> T[]removeAll(T[] array, int... indices) Removes the elements at the specified positions from the specified array.static boolean[]removeAllOccurences(boolean[] array, boolean element) Deprecated.static byte[]removeAllOccurences(byte[] array, byte element) Deprecated.static char[]removeAllOccurences(char[] array, char element) Deprecated.static double[]removeAllOccurences(double[] array, double element) Deprecated.static float[]removeAllOccurences(float[] array, float element) Deprecated.static int[]removeAllOccurences(int[] array, int element) Deprecated.static long[]removeAllOccurences(long[] array, long element) Deprecated.static short[]removeAllOccurences(short[] array, short element) Deprecated.static <T> T[]removeAllOccurences(T[] array, T element) Deprecated.static boolean[]removeAllOccurrences(boolean[] array, boolean element) Removes the occurrences of the specified element from the specified boolean array.static byte[]removeAllOccurrences(byte[] array, byte element) Removes the occurrences of the specified element from the specified byte array.static char[]removeAllOccurrences(char[] array, char element) Removes the occurrences of the specified element from the specified char array.static double[]removeAllOccurrences(double[] array, double element) Removes the occurrences of the specified element from the specified double array.static float[]removeAllOccurrences(float[] array, float element) Removes the occurrences of the specified element from the specified float array.static int[]removeAllOccurrences(int[] array, int element) Removes the occurrences of the specified element from the specified int array.static long[]removeAllOccurrences(long[] array, long element) Removes the occurrences of the specified element from the specified long array.static short[]removeAllOccurrences(short[] array, short element) Removes the occurrences of the specified element from the specified short array.static <T> T[]removeAllOccurrences(T[] array, T element) Removes the occurrences of the specified element from the specified array.static boolean[]removeElement(boolean[] array, boolean element) Removes the first occurrence of the specified element from the specified array.static byte[]removeElement(byte[] array, byte element) Removes the first occurrence of the specified element from the specified array.static char[]removeElement(char[] array, char element) Removes the first occurrence of the specified element from the specified array.static double[]removeElement(double[] array, double element) Removes the first occurrence of the specified element from the specified array.static float[]removeElement(float[] array, float element) Removes the first occurrence of the specified element from the specified array.static int[]removeElement(int[] array, int element) Removes the first occurrence of the specified element from the specified array.static long[]removeElement(long[] array, long element) Removes the first occurrence of the specified element from the specified array.static short[]removeElement(short[] array, short element) Removes the first occurrence of the specified element from the specified array.static <T> T[]removeElement(T[] array, Object element) Removes the first occurrence of the specified element from the specified array.static boolean[]removeElements(boolean[] array, boolean... values) Removes occurrences of specified elements, in specified quantities, from the specified array.static byte[]removeElements(byte[] array, byte... values) Removes occurrences of specified elements, in specified quantities, from the specified array.static char[]removeElements(char[] array, char... values) Removes occurrences of specified elements, in specified quantities, from the specified array.static double[]removeElements(double[] array, double... values) Removes occurrences of specified elements, in specified quantities, from the specified array.static float[]removeElements(float[] array, float... values) Removes occurrences of specified elements, in specified quantities, from the specified array.static int[]removeElements(int[] array, int... values) Removes occurrences of specified elements, in specified quantities, from the specified array.static long[]removeElements(long[] array, long... values) Removes occurrences of specified elements, in specified quantities, from the specified array.static short[]removeElements(short[] array, short... values) Removes occurrences of specified elements, in specified quantities, from the specified array.static <T> T[]removeElements(T[] array, T... values) Removes occurrences of specified elements, in specified quantities, from the specified array.static voidreverse(boolean[] array) Reverses the order of the given array.static voidreverse(boolean[] array, int startIndexInclusive, int endIndexExclusive) Reverses the order of the given array in the given range.static voidreverse(byte[] array) Reverses the order of the given array.static voidreverse(byte[] array, int startIndexInclusive, int endIndexExclusive) Reverses the order of the given array in the given range.static voidreverse(char[] array) Reverses the order of the given array.static voidreverse(char[] array, int startIndexInclusive, int endIndexExclusive) Reverses the order of the given array in the given range.static voidreverse(double[] array) Reverses the order of the given array.static voidreverse(double[] array, int startIndexInclusive, int endIndexExclusive) Reverses the order of the given array in the given range.static voidreverse(float[] array) Reverses the order of the given array.static voidreverse(float[] array, int startIndexInclusive, int endIndexExclusive) Reverses the order of the given array in the given range.static voidreverse(int[] array) Reverses the order of the given array.static voidreverse(int[] array, int startIndexInclusive, int endIndexExclusive) Reverses the order of the given array in the given range.static voidreverse(long[] array) Reverses the order of the given array.static voidreverse(long[] array, int startIndexInclusive, int endIndexExclusive) Reverses the order of the given array in the given range.static voidreverse(short[] array) Reverses the order of the given array.static voidreverse(short[] array, int startIndexInclusive, int endIndexExclusive) Reverses the order of the given array in the given range.static voidReverses the order of the given array.static voidReverses the order of the given array in the given range.static <T> T[]setAll(T[] array, IntFunction<? extends T> generator) Sets all elements of the specified array, using the provided generator supplier to compute each element.static <T> T[]Sets all elements of the specified array, using the provided generator supplier to compute each element.static voidshift(boolean[] array, int offset) Shifts the order of the given boolean array.static voidshift(boolean[] array, int startIndexInclusive, int endIndexExclusive, int offset) Shifts the order of a series of elements in the given boolean array.static voidshift(byte[] array, int offset) Shifts the order of the given byte array.static voidshift(byte[] array, int startIndexInclusive, int endIndexExclusive, int offset) Shifts the order of a series of elements in the given byte array.static voidshift(char[] array, int offset) Shifts the order of the given char array.static voidshift(char[] array, int startIndexInclusive, int endIndexExclusive, int offset) Shifts the order of a series of elements in the given char array.static voidshift(double[] array, int offset) Shifts the order of the given double array.static voidshift(double[] array, int startIndexInclusive, int endIndexExclusive, int offset) Shifts the order of a series of elements in the given double array.static voidshift(float[] array, int offset) Shifts the order of the given float array.static voidshift(float[] array, int startIndexInclusive, int endIndexExclusive, int offset) Shifts the order of a series of elements in the given float array.static voidshift(int[] array, int offset) Shifts the order of the given int array.static voidshift(int[] array, int startIndexInclusive, int endIndexExclusive, int offset) Shifts the order of a series of elements in the given int array.static voidshift(long[] array, int offset) Shifts the order of the given long array.static voidshift(long[] array, int startIndexInclusive, int endIndexExclusive, int offset) Shifts the order of a series of elements in the given long array.static voidshift(short[] array, int offset) Shifts the order of the given short array.static voidshift(short[] array, int startIndexInclusive, int endIndexExclusive, int offset) Shifts the order of a series of elements in the given short array.static voidShifts the order of the given array.static voidShifts the order of a series of elements in the given array.static voidshuffle(boolean[] array) Randomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidshuffle(byte[] array) Randomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidshuffle(char[] array) Randomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidshuffle(double[] array) Randomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidshuffle(float[] array) Randomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidshuffle(int[] array) Randomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidshuffle(long[] array) Randomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidshuffle(short[] array) Randomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.static voidRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.static boolean[]subarray(boolean[] array, int startIndexInclusive, int endIndexExclusive) Produces a newbooleanarray containing the elements between the start and end indices.static byte[]subarray(byte[] array, int startIndexInclusive, int endIndexExclusive) Produces a newbytearray containing the elements between the start and end indices.static char[]subarray(char[] array, int startIndexInclusive, int endIndexExclusive) Produces a newchararray containing the elements between the start and end indices.static double[]subarray(double[] array, int startIndexInclusive, int endIndexExclusive) Produces a newdoublearray containing the elements between the start and end indices.static float[]subarray(float[] array, int startIndexInclusive, int endIndexExclusive) Produces a newfloatarray containing the elements between the start and end indices.static int[]subarray(int[] array, int startIndexInclusive, int endIndexExclusive) Produces a newintarray containing the elements between the start and end indices.static long[]subarray(long[] array, int startIndexInclusive, int endIndexExclusive) Produces a newlongarray containing the elements between the start and end indices.static short[]subarray(short[] array, int startIndexInclusive, int endIndexExclusive) Produces a newshortarray containing the elements between the start and end indices.static <T> T[]subarray(T[] array, int startIndexInclusive, int endIndexExclusive) Produces a new array containing the elements between the start and end indices.static voidswap(boolean[] array, int offset1, int offset2) Swaps two elements in the given boolean array.static voidswap(boolean[] array, int offset1, int offset2, int len) Swaps a series of elements in the given boolean array.static voidswap(byte[] array, int offset1, int offset2) Swaps two elements in the given byte array.static voidswap(byte[] array, int offset1, int offset2, int len) Swaps a series of elements in the given byte array.static voidswap(char[] array, int offset1, int offset2) Swaps two elements in the given char array.static voidswap(char[] array, int offset1, int offset2, int len) Swaps a series of elements in the given char array.static voidswap(double[] array, int offset1, int offset2) Swaps two elements in the given double array.static voidswap(double[] array, int offset1, int offset2, int len) Swaps a series of elements in the given double array.static voidswap(float[] array, int offset1, int offset2) Swaps two elements in the given float array.static voidswap(float[] array, int offset1, int offset2, int len) Swaps a series of elements in the given float array.static voidswap(int[] array, int offset1, int offset2) Swaps two elements in the given int array.static voidswap(int[] array, int offset1, int offset2, int len) Swaps a series of elements in the given int array.static voidswap(long[] array, int offset1, int offset2) Swaps two elements in the given long array.static voidswap(long[] array, int offset1, int offset2, int len) Swaps a series of elements in the given long array.static voidswap(short[] array, int offset1, int offset2) Swaps two elements in the given short array.static voidswap(short[] array, int offset1, int offset2, int len) Swaps a series of elements in the given short array.static voidSwaps two elements in the given array.static voidSwaps a series of elements in the given array.static <T> T[]toArray(T... items) Create a type-safe generic array.Converts the given array into aMap.static Boolean[]toObject(boolean[] array) Converts an array of primitive booleans to objects.static Byte[]toObject(byte[] array) Converts an array of primitive bytes to objects.static Character[]toObject(char[] array) Converts an array of primitive chars to objects.static Double[]toObject(double[] array) Converts an array of primitive doubles to objects.static Float[]toObject(float[] array) Converts an array of primitive floats to objects.static Integer[]toObject(int[] array) Converts an array of primitive ints to objects.static Long[]toObject(long[] array) Converts an array of primitive longs to objects.static Short[]toObject(short[] array) Converts an array of primitive shorts to objects.static boolean[]toPrimitive(Boolean[] array) Converts an array of object Booleans to primitives.static boolean[]toPrimitive(Boolean[] array, boolean valueForNull) Converts an array of object Booleans to primitives handlingnull.static byte[]toPrimitive(Byte[] array) Converts an array of object Bytes to primitives.static byte[]toPrimitive(Byte[] array, byte valueForNull) Converts an array of object Bytes to primitives handlingnull.static char[]toPrimitive(Character[] array) Converts an array of object Characters to primitives.static char[]toPrimitive(Character[] array, char valueForNull) Converts an array of object Character to primitives handlingnull.static double[]toPrimitive(Double[] array) Converts an array of object Doubles to primitives.static double[]toPrimitive(Double[] array, double valueForNull) Converts an array of object Doubles to primitives handlingnull.static float[]toPrimitive(Float[] array) Converts an array of object Floats to primitives.static float[]toPrimitive(Float[] array, float valueForNull) Converts an array of object Floats to primitives handlingnull.static int[]toPrimitive(Integer[] array) Converts an array of object Integers to primitives.static int[]toPrimitive(Integer[] array, int valueForNull) Converts an array of object Integer to primitives handlingnull.static long[]toPrimitive(Long[] array) Converts an array of object Longs to primitives.static long[]toPrimitive(Long[] array, long valueForNull) Converts an array of object Long to primitives handlingnull.static ObjecttoPrimitive(Object array) Create an array of primitive type from an array of wrapper types.static short[]toPrimitive(Short[] array) Converts an array of object Shorts to primitives.static short[]toPrimitive(Short[] array, short valueForNull) Converts an array of object Short to primitives handlingnull.static StringOutputs an array as a String, treatingnullas an empty array.static StringOutputs an array as a String handlingnulls.static String[]toStringArray(Object[] array) Returns an array containing the string representation of each element in the argument array.static String[]toStringArray(Object[] array, String valueForNullElements) Returns an array containing the string representation of each element in the argument array handlingnullelements.
- 
Field Details- 
EMPTY_BOOLEAN_ARRAYAn empty immutablebooleanarray.
- 
EMPTY_BOOLEAN_OBJECT_ARRAYAn empty immutableBooleanarray.
- 
EMPTY_BYTE_ARRAYAn empty immutablebytearray.
- 
EMPTY_BYTE_OBJECT_ARRAYAn empty immutableBytearray.
- 
EMPTY_CHAR_ARRAYAn empty immutablechararray.
- 
EMPTY_CHARACTER_OBJECT_ARRAYAn empty immutableCharacterarray.
- 
EMPTY_CLASS_ARRAYAn empty immutableClassarray.
- 
EMPTY_DOUBLE_ARRAYAn empty immutabledoublearray.
- 
EMPTY_DOUBLE_OBJECT_ARRAYAn empty immutableDoublearray.
- 
EMPTY_FIELD_ARRAYAn empty immutableFieldarray.- Since:
- 3.10
 
- 
EMPTY_FLOAT_ARRAYAn empty immutablefloatarray.
- 
EMPTY_FLOAT_OBJECT_ARRAYAn empty immutableFloatarray.
- 
EMPTY_INT_ARRAYAn empty immutableintarray.
- 
EMPTY_INTEGER_OBJECT_ARRAYAn empty immutableIntegerarray.
- 
EMPTY_LONG_ARRAYAn empty immutablelongarray.
- 
EMPTY_LONG_OBJECT_ARRAYAn empty immutableLongarray.
- 
EMPTY_METHOD_ARRAYAn empty immutableMethodarray.- Since:
- 3.10
 
- 
EMPTY_OBJECT_ARRAYAn empty immutableObjectarray.
- 
EMPTY_SHORT_ARRAYAn empty immutableshortarray.
- 
EMPTY_SHORT_OBJECT_ARRAYAn empty immutableShortarray.
- 
EMPTY_STRING_ARRAYAn empty immutableStringarray.
- 
EMPTY_THROWABLE_ARRAYAn empty immutableThrowablearray.- Since:
- 3.10
 
- 
EMPTY_TYPE_ARRAYAn empty immutableTypearray.- Since:
- 3.10
 
- 
INDEX_NOT_FOUNDThe 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 fromList.- See Also:
 
 
- 
- 
Constructor Details- 
ArrayUtilsDeprecated.TODO Make private in 4.0.ArrayUtils instances should NOT be constructed in standard programming. Instead, the class should be used asArrayUtils.clone(new int[] {2}).This constructor is public to permit tools that require a JavaBean instance to operate. 
 
- 
- 
Method Details- 
addCopies 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
- element- the object to add at the last index of the new array
- Returns:
- A new array containing the existing elements plus the new element
- Since:
- 2.1
 
- 
addDeprecated.this method has been superseded byinsert(int, boolean[], boolean...)and may be removed in a future release. Please note the handling ofnullinput arrays differs in the new method: insertingXinto anullarray results innullnotX.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
- index- the position of the new object
- element- the object to add
- Returns:
- 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).
 
- 
addCopies 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
- element- the object to add at the last index of the new array
- Returns:
- A new array containing the existing elements plus the new element
- Since:
- 2.1
 
- 
addDeprecated.this method has been superseded byinsert(int, byte[], byte...)and may be removed in a future release. Please note the handling ofnullinput arrays differs in the new method: insertingXinto anullarray results innullnotX.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
- index- the position of the new object
- element- the object to add
- Returns:
- 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).
 
- 
addCopies 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
- element- the object to add at the last index of the new array
- Returns:
- A new array containing the existing elements plus the new element
- Since:
- 2.1
 
- 
addDeprecated.this method has been superseded byinsert(int, char[], char...)and may be removed in a future release. Please note the handling ofnullinput arrays differs in the new method: insertingXinto anullarray results innullnotX.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
- index- the position of the new object
- element- the object to add
- Returns:
- 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).
 
- 
addCopies 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
- element- the object to add at the last index of the new array
- Returns:
- A new array containing the existing elements plus the new element
- Since:
- 2.1
 
- 
addDeprecated.this method has been superseded byinsert(int, double[], double...)and may be removed in a future release. Please note the handling ofnullinput arrays differs in the new method: insertingXinto anullarray results innullnotX.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
- index- the position of the new object
- element- the object to add
- Returns:
- 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).
 
- 
addCopies 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
- element- the object to add at the last index of the new array
- Returns:
- A new array containing the existing elements plus the new element
- Since:
- 2.1
 
- 
addDeprecated.this method has been superseded byinsert(int, float[], float...)and may be removed in a future release. Please note the handling ofnullinput arrays differs in the new method: insertingXinto anullarray results innullnotX.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
- index- the position of the new object
- element- the object to add
- Returns:
- 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).
 
- 
addCopies 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
- element- the object to add at the last index of the new array
- Returns:
- A new array containing the existing elements plus the new element
- Since:
- 2.1
 
- 
addDeprecated.this method has been superseded byinsert(int, int[], int...)and may be removed in a future release. Please note the handling ofnullinput arrays differs in the new method: insertingXinto anullarray results innullnotX.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
- index- the position of the new object
- element- the object to add
- Returns:
- 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).
 
- 
addDeprecated.this method has been superseded byinsert(int, long[], long...)and may be removed in a future release. Please note the handling ofnullinput arrays differs in the new method: insertingXinto anullarray results innullnotX.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
- index- the position of the new object
- element- the object to add
- Returns:
- 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).
 
- 
addCopies 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
- element- the object to add at the last index of the new array
- Returns:
- A new array containing the existing elements plus the new element
- Since:
- 2.1
 
- 
addDeprecated.this method has been superseded byinsert(int, short[], short...)and may be removed in a future release. Please note the handling ofnullinput arrays differs in the new method: insertingXinto anullarray results innullnotX.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
- index- the position of the new object
- element- the object to add
- Returns:
- 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).
 
- 
addCopies 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
- element- the object to add at the last index of the new array
- Returns:
- A new array containing the existing elements plus the new element
- Since:
- 2.1
 
- 
addDeprecated.this method has been superseded byinsert(int, T[], T...)and may be removed in a future release. Please note the handling ofnullinput arrays differs in the new method: insertingXinto anullarray results innullnotX.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) = IllegalArgumentException 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"] - Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array to add the element to, may be- null
- index- the position of the new object
- element- the object to add
- Returns:
- 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).
- IllegalArgumentException- if both array and element are null
 
- 
addCopies 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, unless the element itself is null, in which case the return type is Object[]ArrayUtils.add(null, null) = IllegalArgumentException 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"] - Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array to "add" the element to, may be- null
- element- the object to add, may be- null
- Returns:
- A new array containing the existing elements plus the new element The returned array type will be that of the input array (unless null), in which case it will have the same type as the element. If both are null, an IllegalArgumentException is thrown
- Throws:
- IllegalArgumentException- if both arguments are null
- Since:
- 2.1
 
- 
addAllAdds all the elements of the given arrays into a new array.The new array contains all of the element of array1followed by all of the elementsarray2. 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([], []) = [] ArrayUtils.addAll(null, null) = null - Parameters:
- array1- the first array whose elements are added to the new array.
- array2- the second array whose elements are added to the new array.
- Returns:
- The new boolean[] array or null.
- Since:
- 2.1
 
- 
addAllAdds all the elements of the given arrays into a new array.The new array contains all of the element of array1followed by all of the elementsarray2. 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([], []) = [] ArrayUtils.addAll(null, null) = null - Parameters:
- array1- the first array whose elements are added to the new array.
- array2- the second array whose elements are added to the new array.
- Returns:
- The new byte[] array or null.
- Since:
- 2.1
 
- 
addAllAdds all the elements of the given arrays into a new array.The new array contains all of the element of array1followed by all of the elementsarray2. 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([], []) = [] ArrayUtils.addAll(null, null) = null - Parameters:
- array1- the first array whose elements are added to the new array.
- array2- the second array whose elements are added to the new array.
- Returns:
- The new char[] array or null.
- Since:
- 2.1
 
- 
addAllAdds all the elements of the given arrays into a new array.The new array contains all of the element of array1followed by all of the elementsarray2. 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([], []) = [] ArrayUtils.addAll(null, null) = null - Parameters:
- array1- the first array whose elements are added to the new array.
- array2- the second array whose elements are added to the new array.
- Returns:
- The new double[] array or null.
- Since:
- 2.1
 
- 
addAllAdds all the elements of the given arrays into a new array.The new array contains all of the element of array1followed by all of the elementsarray2. 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([], []) = [] ArrayUtils.addAll(null, null) = null - Parameters:
- array1- the first array whose elements are added to the new array.
- array2- the second array whose elements are added to the new array.
- Returns:
- The new float[] array or null.
- Since:
- 2.1
 
- 
addAllAdds all the elements of the given arrays into a new array.The new array contains all of the element of array1followed by all of the elementsarray2. 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([], []) = [] ArrayUtils.addAll(null, null) = null - Parameters:
- array1- the first array whose elements are added to the new array.
- array2- the second array whose elements are added to the new array.
- Returns:
- The new int[] array or null.
- Since:
- 2.1
 
- 
addAllAdds all the elements of the given arrays into a new array.The new array contains all of the element of array1followed by all of the elementsarray2. 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([], []) = [] ArrayUtils.addAll(null, null) = null - Parameters:
- array1- the first array whose elements are added to the new array.
- array2- the second array whose elements are added to the new array.
- Returns:
- The new long[] array or null.
- Since:
- 2.1
 
- 
addAllAdds all the elements of the given arrays into a new array.The new array contains all of the element of array1followed by all of the elementsarray2. 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([], []) = [] ArrayUtils.addAll(null, null) = null - Parameters:
- array1- the first array whose elements are added to the new array.
- array2- the second array whose elements are added to the new array.
- Returns:
- The new short[] array or null.
- Since:
- 2.1
 
- 
addAllAdds all the elements of the given arrays into a new array.The new array contains all of the element of array1followed by all of the elementsarray2. 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 ArrayUtils.addAll([null], [null]) = [null, null] ArrayUtils.addAll(["a", "b", "c"], ["1", "2", "3"]) = ["a", "b", "c", "1", "2", "3"] - Type Parameters:
- T- the component type of the array
- Parameters:
- array1- the first array whose elements are added to the new array, may be- null
- array2- the second array whose elements are added to the new array, may be- null
- Returns:
- The new array, nullif both arrays arenull. The type of the new array is the type of the first array, unless the first array is null, in which case the type is the same as the second array.
- Throws:
- IllegalArgumentException- if the array types are incompatible
- Since:
- 2.1
 
- 
addFirstCopies the given array and adds the given element at the beginning of the new array.The new array contains the same elements of the input array plus the given element in the first 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.addFirst(null, true) = [true] ArrayUtils.addFirst([true], false) = [false, true] ArrayUtils.addFirst([true, false], true) = [true, true, false] - Parameters:
- array- the array to "add" the element to, may be- null.
- element- the object to add.
- Returns:
- A new array containing the existing elements plus the new element The returned array type will be that of the input array (unless null), in which case it will have the same type as the element.
- Since:
- 3.10
 
- 
addFirstCopies the given array and adds the given element at the beginning of the new array.The new array contains the same elements of the input array plus the given element in the first 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.addFirst(null, 1) = [1] ArrayUtils.addFirst([1], 0) = [0, 1] ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0] - Parameters:
- array- the array to "add" the element to, may be- null.
- element- the object to add.
- Returns:
- A new array containing the existing elements plus the new element The returned array type will be that of the input array (unless null), in which case it will have the same type as the element.
- Since:
- 3.10
 
- 
addFirstCopies the given array and adds the given element at the beginning of the new array.The new array contains the same elements of the input array plus the given element in the first 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.addFirst(null, '1') = ['1'] ArrayUtils.addFirst(['1'], '0') = ['0', '1'] ArrayUtils.addFirst(['1', '0'], '1') = ['1', '1', '0'] - Parameters:
- array- the array to "add" the element to, may be- null.
- element- the object to add.
- Returns:
- A new array containing the existing elements plus the new element The returned array type will be that of the input array (unless null), in which case it will have the same type as the element.
- Since:
- 3.10
 
- 
addFirstCopies the given array and adds the given element at the beginning of the new array.The new array contains the same elements of the input array plus the given element in the first 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.addFirst(null, 1) = [1] ArrayUtils.addFirst([1], 0) = [0, 1] ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0] - Parameters:
- array- the array to "add" the element to, may be- null.
- element- the object to add.
- Returns:
- A new array containing the existing elements plus the new element The returned array type will be that of the input array (unless null), in which case it will have the same type as the element.
- Since:
- 3.10
 
- 
addFirstCopies the given array and adds the given element at the beginning of the new array.The new array contains the same elements of the input array plus the given element in the first 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.addFirst(null, 1) = [1] ArrayUtils.addFirst([1], 0) = [0, 1] ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0] - Parameters:
- array- the array to "add" the element to, may be- null.
- element- the object to add.
- Returns:
- A new array containing the existing elements plus the new element The returned array type will be that of the input array (unless null), in which case it will have the same type as the element.
- Since:
- 3.10
 
- 
addFirstCopies the given array and adds the given element at the beginning of the new array.The new array contains the same elements of the input array plus the given element in the first 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.addFirst(null, 1) = [1] ArrayUtils.addFirst([1], 0) = [0, 1] ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0] - Parameters:
- array- the array to "add" the element to, may be- null.
- element- the object to add.
- Returns:
- A new array containing the existing elements plus the new element The returned array type will be that of the input array (unless null), in which case it will have the same type as the element.
- Since:
- 3.10
 
- 
addFirstCopies the given array and adds the given element at the beginning of the new array.The new array contains the same elements of the input array plus the given element in the first 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.addFirst(null, 1) = [1] ArrayUtils.addFirst([1], 0) = [0, 1] ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0] - Parameters:
- array- the array to "add" the element to, may be- null.
- element- the object to add.
- Returns:
- A new array containing the existing elements plus the new element The returned array type will be that of the input array (unless null), in which case it will have the same type as the element.
- Since:
- 3.10
 
- 
addFirstCopies the given array and adds the given element at the beginning of the new array.The new array contains the same elements of the input array plus the given element in the first 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.addFirst(null, 1) = [1] ArrayUtils.addFirst([1], 0) = [0, 1] ArrayUtils.addFirst([1, 0], 1) = [1, 1, 0] - Parameters:
- array- the array to "add" the element to, may be- null.
- element- the object to add.
- Returns:
- A new array containing the existing elements plus the new element The returned array type will be that of the input array (unless null), in which case it will have the same type as the element.
- Since:
- 3.10
 
- 
addFirstCopies the given array and adds the given element at the beginning of the new array.The new array contains the same elements of the input array plus the given element in the first 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, unless the element itself is null, in which case the return type is Object[]ArrayUtils.addFirst(null, null) = IllegalArgumentException ArrayUtils.addFirst(null, "a") = ["a"] ArrayUtils.addFirst(["a"], null) = [null, "a"] ArrayUtils.addFirst(["a"], "b") = ["b", "a"] ArrayUtils.addFirst(["a", "b"], "c") = ["c", "a", "b"] - Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array to "add" the element to, may be- null
- element- the object to add, may be- null
- Returns:
- A new array containing the existing elements plus the new element The returned array type will be that of the input array (unless null), in which case it will have the same type as the element. If both are null, an IllegalArgumentException is thrown
- Throws:
- IllegalArgumentException- if both arguments are null
- Since:
- 3.10
 
- 
arraycopypublic static <T> T arraycopy(T source, int sourcePos, int destPos, int length, Function<Integer, T> allocator) A fluent version ofSystem.arraycopy(Object, int, Object, int, int)that returns the destination array.- Type Parameters:
- T- the type.
- Parameters:
- source- the source array.
- sourcePos- starting position in the source array.
- destPos- starting position in the destination data.
- length- the number of array elements to be copied.
- allocator- allocates the array to populate and return.
- Returns:
- dest
- Throws:
- IndexOutOfBoundsException- if copying would cause access of data outside array bounds.
- ArrayStoreException- if an element in the- srcarray could not be stored into the- destarray because of a type mismatch.
- NullPointerException- if either- srcor- destis- null.
- Since:
- 3.15.0
 
- 
arraycopypublic static <T> T arraycopy(T source, int sourcePos, int destPos, int length, Supplier<T> allocator) A fluent version ofSystem.arraycopy(Object, int, Object, int, int)that returns the destination array.- Type Parameters:
- T- the type.
- Parameters:
- source- the source array.
- sourcePos- starting position in the source array.
- destPos- starting position in the destination data.
- length- the number of array elements to be copied.
- allocator- allocates the array to populate and return.
- Returns:
- dest
- Throws:
- IndexOutOfBoundsException- if copying would cause access of data outside array bounds.
- ArrayStoreException- if an element in the- srcarray could not be stored into the- destarray because of a type mismatch.
- NullPointerException- if either- srcor- destis- null.
- Since:
- 3.15.0
 
- 
arraycopyA fluent version ofSystem.arraycopy(Object, int, Object, int, int)that returns the destination array.- Type Parameters:
- T- the type
- Parameters:
- source- the source array.
- sourcePos- starting position in the source array.
- dest- the destination array.
- destPos- starting position in the destination data.
- length- the number of array elements to be copied.
- Returns:
- dest
- Throws:
- IndexOutOfBoundsException- if copying would cause access of data outside array bounds.
- ArrayStoreException- if an element in the- srcarray could not be stored into the- destarray because of a type mismatch.
- NullPointerException- if either- srcor- destis- null.
- Since:
- 3.15.0
 
- 
cloneClones an array or returnsnull.This method returns nullfor anullinput array.- Parameters:
- array- the array to clone, may be- null
- Returns:
- the cloned array, nullifnullinput
 
- 
cloneClones an array or returnsnull.This method returns nullfor anullinput array.- Parameters:
- array- the array to clone, may be- null
- Returns:
- the cloned array, nullifnullinput
 
- 
cloneClones an array or returnsnull.This method returns nullfor anullinput array.- Parameters:
- array- the array to clone, may be- null
- Returns:
- the cloned array, nullifnullinput
 
- 
cloneClones an array or returnsnull.This method returns nullfor anullinput array.- Parameters:
- array- the array to clone, may be- null
- Returns:
- the cloned array, nullifnullinput
 
- 
cloneClones an array or returnsnull.This method returns nullfor anullinput array.- Parameters:
- array- the array to clone, may be- null
- Returns:
- the cloned array, nullifnullinput
 
- 
cloneClones an array or returnsnull.This method returns nullfor anullinput array.- Parameters:
- array- the array to clone, may be- null
- Returns:
- the cloned array, nullifnullinput
 
- 
cloneClones an array or returnsnull.This method returns nullfor anullinput array.- Parameters:
- array- the array to clone, may be- null
- Returns:
- the cloned array, nullifnullinput
 
- 
cloneClones an array or returnsnull.This method returns nullfor anullinput array.- Parameters:
- array- the array to clone, may be- null
- Returns:
- the cloned array, nullifnullinput
 
- 
cloneShallow clones an array or returnsnull.The objects in the array are not cloned, thus there is no special handling for multi-dimensional arrays. This method returns nullfor anullinput array.- Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array to shallow clone, may be- null
- Returns:
- the cloned array, nullifnullinput
 
- 
containsChecks if the value is in the given array.The method returns falseif anullarray is passed in.- Parameters:
- array- the array to search through
- valueToFind- the value to find
- Returns:
- trueif the array contains the object
 
- 
containsChecks if the value is in the given array.The method returns falseif anullarray is passed in.- Parameters:
- array- the array to search through
- valueToFind- the value to find
- Returns:
- trueif the array contains the object
 
- 
containsChecks if the value is in the given array.The method returns falseif anullarray is passed in.- Parameters:
- array- the array to search through
- valueToFind- the value to find
- Returns:
- trueif the array contains the object
- Since:
- 2.1
 
- 
containsChecks if the value is in the given array.The method returns falseif anullarray is passed in.- Parameters:
- array- the array to search through
- valueToFind- the value to find
- Returns:
- trueif the array contains the object
 
- 
containsChecks 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 falseif anullarray is passed in.- Parameters:
- array- the array to search
- valueToFind- the value to find
- tolerance- the array contains the tolerance of the search
- Returns:
- true if value falling within tolerance is in array
 
- 
containsChecks if the value is in the given array.The method returns falseif anullarray is passed in.- Parameters:
- array- the array to search through
- valueToFind- the value to find
- Returns:
- trueif the array contains the object
 
- 
containsChecks if the value is in the given array.The method returns falseif anullarray is passed in.- Parameters:
- array- the array to search through
- valueToFind- the value to find
- Returns:
- trueif the array contains the object
 
- 
containsChecks if the value is in the given array.The method returns falseif anullarray is passed in.- Parameters:
- array- the array to search through
- valueToFind- the value to find
- Returns:
- trueif the array contains the object
 
- 
containsChecks if the object is in the given array.The method returns falseif anullarray is passed in.- Parameters:
- array- the array to search through
- objectToFind- the object to find
- Returns:
- trueif the array contains the object
 
- 
containsChecks if the value is in the given array.The method returns falseif anullarray is passed in.- Parameters:
- array- the array to search through
- valueToFind- the value to find
- Returns:
- trueif the array contains the object
 
- 
containsAnyChecks if any of the objects are in the given array.The method returns falseif anullarray is passed in.- Parameters:
- array- the array to search through
- objectsToFind- any of the objects to find
- Returns:
- trueif the array contains any of the objects
- Since:
- 3.13.0
 
- 
getGets the nTh element of an array or null if the index is out of bounds or the array is null.- Type Parameters:
- T- The type of array elements.
- Parameters:
- array- The array to index.
- index- The index
- Returns:
- the nTh element of an array or null if the index is out of bounds or the array is null.
- Since:
- 3.11
 
- 
getGets the nTh element of an array or a default value if the index is out of bounds.- Type Parameters:
- T- The type of array elements.
- Parameters:
- array- The array to index.
- index- The index
- defaultValue- The return value of the given index is out of bounds.
- Returns:
- the nTh element of an array or a default value if the index is out of bounds.
- Since:
- 3.11
 
- 
getComponentTypeGets an array's component type.- Type Parameters:
- T- The array type.
- Parameters:
- array- The array.
- Returns:
- The component type.
- Since:
- 3.13.0
 
- 
getLengthReturns the length of the specified array. This method can deal withObjectarrays and with primitive arrays.If the input array is null,0is 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
- Returns:
- The length of the array, or 0if the array isnull
- Throws:
- IllegalArgumentException- if the object argument is not an array.
- Since:
- 2.1
 
- 
hashCodeGets a hash code for an array handling multidimensional arrays correctly.Multi-dimensional primitive arrays are also handled correctly by this method. - Parameters:
- array- the array to get a hash code for,- nullreturns zero
- Returns:
- a hash code for the array
 
- 
indexesOfFinds the indices of the given value in the array.This method returns an empty BitSet for a nullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array starting at the given index.This method returns an empty BitSet for a nullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return an empty BitSet ( -1).- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array.This method returns an empty BitSet for a nullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array starting at the given index.This method returns an empty BitSet for a nullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return an empty BitSet. - Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array.This method returns an empty BitSet for a nullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array starting at the given index.This method returns an empty BitSet for a nullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return an empty BitSet. - Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array.This method returns empty BitSet for a nullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value within a given tolerance in the array.This method will return all the indices of the value which fall between the region defined by valueToFind - tolerance and valueToFind + tolerance, each time between the nearest integers. This method returns an empty BitSet for a nullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- tolerance- tolerance of the search
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array starting at the given index.This method returns an empty BitSet for a nullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return an empty BitSet. - Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- a BitSet of the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfpublic static BitSet indexesOf(double[] array, double valueToFind, int startIndex, double tolerance) Finds the indices of the given value in the array starting at the given index.This method will return the indices of the values which fall between the region defined by valueToFind - tolerance and valueToFind + tolerance, between the nearest integers. This method returns an empty BitSet for a nullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return an empty BitSet. - Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- tolerance- tolerance of the search
- Returns:
- a BitSet of the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array.This method returns an empty BitSet for a nullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array starting at the given index.This method returns an empty BitSet for a nullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return empty BitSet. - Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array.This method returns an empty BitSet for a nullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array starting at the given index.This method returns an empty BitSet for a nullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return an empty BitSet. - Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array.This method returns an empty BitSet for a nullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array starting at the given index.This method returns an empty BitSet for a nullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return an empty BitSet. - Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given object in the array.This method returns an empty BitSet for a nullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- objectToFind- the object to find, may be- null
- Returns:
- a BitSet of all the indices of the object within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given object in the array starting at the given index.This method returns an empty BitSet for a nullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return an empty BitSet. - Parameters:
- array- the array to search through for the object, may be- null
- objectToFind- the object to find, may be- null
- startIndex- the index to start searching at
- Returns:
- a BitSet of all the indices of the object within the array starting at the index,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array.This method returns an empty BitSet for a nullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexesOfFinds the indices of the given value in the array starting at the given index.This method returns an empty BitSet for a nullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return an empty BitSet. - Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- a BitSet of all the indices of the value within the array,
  an empty BitSet if not found or nullarray input
- Since:
- 3.10
 
- 
indexOfFinds the index of the given value in the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return INDEX_NOT_FOUND(-1).- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return INDEX_NOT_FOUND(-1).- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
- Since:
- 2.1
 
- 
indexOfFinds the index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return INDEX_NOT_FOUND(-1).- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
- Since:
- 2.1
 
- 
indexOfFinds the index of the given value in the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds 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 INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- tolerance- tolerance of the search
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return INDEX_NOT_FOUND(-1).- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds 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 INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return INDEX_NOT_FOUND(-1).- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- tolerance- tolerance of the search
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return INDEX_NOT_FOUND(-1).- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return INDEX_NOT_FOUND(-1).- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- the index of the value within the array, INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return INDEX_NOT_FOUND(-1).- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given object in the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- objectToFind- the object to find, may be- null
- Returns:
- the index of the object within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given object in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return INDEX_NOT_FOUND(-1).- Parameters:
- array- the array to search through for the object, may be- null
- objectToFind- the object to find, may be- null
- startIndex- the index to start searching at
- Returns:
- the index of the object within the array starting at the index,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
indexOfFinds the index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex is treated as zero. A startIndex larger than the array length will return INDEX_NOT_FOUND(-1).- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- startIndex- the index to start searching at
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
insertInserts elements into an array at the given index (starting from zero).When an array is returned, it is always a new array. ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null - Parameters:
- index- the position within- arrayto insert the new values
- array- the array to insert the values into, may be- null
- values- the new values to insert, may be- null
- Returns:
- The new array or nullif the given array isnull.
- Throws:
- IndexOutOfBoundsException- if- arrayis provided and either- index < 0or- index > array.length
- Since:
- 3.6
 
- 
insertInserts elements into an array at the given index (starting from zero).When an array is returned, it is always a new array. ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null - Parameters:
- index- the position within- arrayto insert the new values
- array- the array to insert the values into, may be- null
- values- the new values to insert, may be- null
- Returns:
- The new array or nullif the given array isnull.
- Throws:
- IndexOutOfBoundsException- if- arrayis provided and either- index < 0or- index > array.length
- Since:
- 3.6
 
- 
insertInserts elements into an array at the given index (starting from zero).When an array is returned, it is always a new array. ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null - Parameters:
- index- the position within- arrayto insert the new values
- array- the array to insert the values into, may be- null
- values- the new values to insert, may be- null
- Returns:
- The new array or nullif the given array isnull.
- Throws:
- IndexOutOfBoundsException- if- arrayis provided and either- index < 0or- index > array.length
- Since:
- 3.6
 
- 
insertInserts elements into an array at the given index (starting from zero).When an array is returned, it is always a new array. ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null - Parameters:
- index- the position within- arrayto insert the new values
- array- the array to insert the values into, may be- null
- values- the new values to insert, may be- null
- Returns:
- The new array or nullif the given array isnull.
- Throws:
- IndexOutOfBoundsException- if- arrayis provided and either- index < 0or- index > array.length
- Since:
- 3.6
 
- 
insertInserts elements into an array at the given index (starting from zero).When an array is returned, it is always a new array. ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null - Parameters:
- index- the position within- arrayto insert the new values
- array- the array to insert the values into, may be- null
- values- the new values to insert, may be- null
- Returns:
- The new array or nullif the given array isnull.
- Throws:
- IndexOutOfBoundsException- if- arrayis provided and either- index < 0or- index > array.length
- Since:
- 3.6
 
- 
insertInserts elements into an array at the given index (starting from zero).When an array is returned, it is always a new array. ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null - Parameters:
- index- the position within- arrayto insert the new values
- array- the array to insert the values into, may be- null
- values- the new values to insert, may be- null
- Returns:
- The new array or nullif the given array isnull.
- Throws:
- IndexOutOfBoundsException- if- arrayis provided and either- index < 0or- index > array.length
- Since:
- 3.6
 
- 
insertInserts elements into an array at the given index (starting from zero).When an array is returned, it is always a new array. ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null - Parameters:
- index- the position within- arrayto insert the new values
- array- the array to insert the values into, may be- null
- values- the new values to insert, may be- null
- Returns:
- The new array or nullif the given array isnull.
- Throws:
- IndexOutOfBoundsException- if- arrayis provided and either- index < 0or- index > array.length
- Since:
- 3.6
 
- 
insertInserts elements into an array at the given index (starting from zero).When an array is returned, it is always a new array. ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null - Parameters:
- index- the position within- arrayto insert the new values
- array- the array to insert the values into, may be- null
- values- the new values to insert, may be- null
- Returns:
- The new array or nullif the given array isnull.
- Throws:
- IndexOutOfBoundsException- if- arrayis provided and either- index < 0or- index > array.length
- Since:
- 3.6
 
- 
insertInserts elements into an array at the given index (starting from zero).When an array is returned, it is always a new array. ArrayUtils.insert(index, null, null) = null ArrayUtils.insert(index, array, null) = cloned copy of 'array' ArrayUtils.insert(index, null, values) = null - Type Parameters:
- T- The type of elements in- arrayand- values
- Parameters:
- index- the position within- arrayto insert the new values
- array- the array to insert the values into, may be- null
- values- the new values to insert, may be- null
- Returns:
- The new array or nullif the given array isnull.
- Throws:
- IndexOutOfBoundsException- if- arrayis provided and either- index < 0or- index > array.length
- Since:
- 3.6
 
- 
isArrayIndexValidReturns whether a given array can safely be accessed at the given index.ArrayUtils.isArrayIndexValid(null, 0) = false ArrayUtils.isArrayIndexValid([], 0) = false ArrayUtils.isArrayIndexValid(["a"], 0) = true - Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array to inspect, may be null
- index- the index of the array to be inspected
- Returns:
- Whether the given index is safely-accessible in the given array
- Since:
- 3.8
 
- 
isEmptyChecks if an array of primitive booleans is empty ornull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is empty or- null
- Since:
- 2.1
 
- 
isEmptyChecks if an array of primitive bytes is empty ornull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is empty or- null
- Since:
- 2.1
 
- 
isEmptyChecks if an array of primitive chars is empty ornull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is empty or- null
- Since:
- 2.1
 
- 
isEmptyChecks if an array of primitive doubles is empty ornull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is empty or- null
- Since:
- 2.1
 
- 
isEmptyChecks if an array of primitive floats is empty ornull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is empty or- null
- Since:
- 2.1
 
- 
isEmptyChecks if an array of primitive ints is empty ornull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is empty or- null
- Since:
- 2.1
 
- 
isEmptyChecks if an array of primitive longs is empty ornull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is empty or- null
- Since:
- 2.1
 
- 
isEmptyChecks if an array of Objects is empty ornull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is empty or- null
- Since:
- 2.1
 
- 
isEmptyChecks if an array of primitive shorts is empty ornull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is empty or- null
- Since:
- 2.1
 
- 
isEqualsDeprecated.this method has been replaced byjava.util.Objects.deepEquals(Object, Object)and will be removed from future releases.Compares two arrays, using equals(), handling multidimensional arrays correctly.Multi-dimensional primitive arrays are also handled correctly by this method. - Parameters:
- array1- the left-hand side array to compare, may be- null
- array2- the right-hand side array to compare, may be- null
- Returns:
- trueif the arrays are equal
 
- 
isNotEmptyChecks if an array of primitive booleans is not empty and notnull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is not empty and not- null
- Since:
- 2.5
 
- 
isNotEmptyChecks if an array of primitive bytes is not empty and notnull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is not empty and not- null
- Since:
- 2.5
 
- 
isNotEmptyChecks if an array of primitive chars is not empty and notnull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is not empty and not- null
- Since:
- 2.5
 
- 
isNotEmptyChecks if an array of primitive doubles is not empty and notnull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is not empty and not- null
- Since:
- 2.5
 
- 
isNotEmptyChecks if an array of primitive floats is not empty and notnull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is not empty and not- null
- Since:
- 2.5
 
- 
isNotEmptyChecks if an array of primitive ints is not empty and notnull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is not empty and not- null
- Since:
- 2.5
 
- 
isNotEmptyChecks if an array of primitive longs is not empty and notnull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is not empty and not- null
- Since:
- 2.5
 
- 
isNotEmptyChecks if an array of primitive shorts is not empty and notnull.- Parameters:
- array- the array to test
- Returns:
- trueif the array is not empty and not- null
- Since:
- 2.5
 
- 
isNotEmptyChecks if an array of Objects is not empty and notnull.- Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array to test
- Returns:
- trueif the array is not empty and not- null
- Since:
- 2.5
 
- 
isSameLengthChecks whether two arrays are the same length, treatingnullarrays as length0.- Parameters:
- array1- the first array, may be- null
- array2- the second array, may be- null
- Returns:
- trueif length of arrays matches, treating- nullas an empty array
 
- 
isSameLengthChecks whether two arrays are the same length, treatingnullarrays as length0.- Parameters:
- array1- the first array, may be- null
- array2- the second array, may be- null
- Returns:
- trueif length of arrays matches, treating- nullas an empty array
 
- 
isSameLengthChecks whether two arrays are the same length, treatingnullarrays as length0.- Parameters:
- array1- the first array, may be- null
- array2- the second array, may be- null
- Returns:
- trueif length of arrays matches, treating- nullas an empty array
 
- 
isSameLengthChecks whether two arrays are the same length, treatingnullarrays as length0.- Parameters:
- array1- the first array, may be- null
- array2- the second array, may be- null
- Returns:
- trueif length of arrays matches, treating- nullas an empty array
 
- 
isSameLengthChecks whether two arrays are the same length, treatingnullarrays as length0.- Parameters:
- array1- the first array, may be- null
- array2- the second array, may be- null
- Returns:
- trueif length of arrays matches, treating- nullas an empty array
 
- 
isSameLengthChecks whether two arrays are the same length, treatingnullarrays as length0.- Parameters:
- array1- the first array, may be- null
- array2- the second array, may be- null
- Returns:
- trueif length of arrays matches, treating- nullas an empty array
 
- 
isSameLengthChecks whether two arrays are the same length, treatingnullarrays as length0.- Parameters:
- array1- the first array, may be- null
- array2- the second array, may be- null
- Returns:
- trueif length of arrays matches, treating- nullas an empty array
 
- 
isSameLengthChecks whether two arrays are the same length, treatingnullarrays as length0.Any multi-dimensional aspects of the arrays are ignored. - Parameters:
- array1- the first array, may be- null
- array2- the second array, may be- null
- Returns:
- trueif length of arrays matches, treating- nullas an empty array
- Since:
- 3.11
 
- 
isSameLengthChecks whether two arrays are the same length, treatingnullarrays as length0.Any multi-dimensional aspects of the arrays are ignored. - Parameters:
- array1- the first array, may be- null
- array2- the second array, may be- null
- Returns:
- trueif length of arrays matches, treating- nullas an empty array
 
- 
isSameLengthChecks whether two arrays are the same length, treatingnullarrays as length0.- Parameters:
- array1- the first array, may be- null
- array2- the second array, may be- null
- Returns:
- trueif length of arrays matches, treating- nullas an empty array
 
- 
isSameTypeChecks whether two arrays are the same type taking into account multidimensional arrays.- Parameters:
- array1- the first array, must not be- null
- array2- the second array, must not be- null
- Returns:
- trueif type of arrays matches
- Throws:
- IllegalArgumentException- if either array is- null
 
- 
isSortedThis method checks whether the provided array is sorted according to natural ordering (falsebeforetrue).- Parameters:
- array- the array to check
- Returns:
- whether the array is sorted according to natural ordering
- Since:
- 3.4
 
- 
isSortedChecks whether the provided array is sorted according to natural ordering.- Parameters:
- array- the array to check
- Returns:
- whether the array is sorted according to natural ordering
- Since:
- 3.4
 
- 
isSortedChecks whether the provided array is sorted according to natural ordering.- Parameters:
- array- the array to check
- Returns:
- whether the array is sorted according to natural ordering
- Since:
- 3.4
 
- 
isSortedThis method checks whether the provided array is sorted according to natural ordering.- Parameters:
- array- the array to check
- Returns:
- whether the array is sorted according to natural ordering
- Since:
- 3.4
 
- 
isSortedThis method checks whether the provided array is sorted according to natural ordering.- Parameters:
- array- the array to check
- Returns:
- whether the array is sorted according to natural ordering
- Since:
- 3.4
 
- 
isSortedThis method checks whether the provided array is sorted according to natural ordering.- Parameters:
- array- the array to check
- Returns:
- whether the array is sorted according to natural ordering
- Since:
- 3.4
 
- 
isSortedThis method checks whether the provided array is sorted according to natural ordering.- Parameters:
- array- the array to check
- Returns:
- whether the array is sorted according to natural ordering
- Since:
- 3.4
 
- 
isSortedThis method checks whether the provided array is sorted according to natural ordering.- Parameters:
- array- the array to check
- Returns:
- whether the array is sorted according to natural ordering
- Since:
- 3.4
 
- 
isSortedThis method checks whether the provided array is sorted according to the class'scompareTomethod.- Type Parameters:
- T- the datatype of the array to check, it must implement- Comparable
- Parameters:
- array- the array to check
- Returns:
- whether the array is sorted
- Since:
- 3.4
 
- 
isSortedThis method checks whether the provided array is sorted according to the providedComparator.- Type Parameters:
- T- the datatype of the array
- Parameters:
- array- the array to check
- comparator- the- Comparatorto compare over
- Returns:
- whether the array is sorted
- Throws:
- NullPointerException- if- comparatoris- null
- Since:
- 3.4
 
- 
lastIndexOfFinds the last index of the given value within the array.This method returns INDEX_NOT_FOUND(-1) ifnullarray input.- Parameters:
- array- the array to traverse backwards looking for the object, may be- null
- valueToFind- the object to find
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex will return 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
- valueToFind- the value to find
- startIndex- the start index to traverse backwards from
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value within the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to traverse backwards looking for the object, may be- null
- valueToFind- the object to find
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex will return 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
- valueToFind- the value to find
- startIndex- the start index to traverse backwards from
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value within the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to traverse backwards looking for the object, may be- null
- valueToFind- the object to find
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
- Since:
- 2.1
 
- 
lastIndexOfFinds the last index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex will return 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
- valueToFind- the value to find
- startIndex- the start index to traverse backwards from
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
- Since:
- 2.1
 
- 
lastIndexOfFinds the last index of the given value within the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to traverse backwards looking for the object, may be- null
- valueToFind- the object to find
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds 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 INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to search through for the object, may be- null
- valueToFind- the value to find
- tolerance- tolerance of the search
- Returns:
- the index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex will return 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
- valueToFind- the value to find
- startIndex- the start index to traverse backwards from
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds 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 INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex will return 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
- valueToFind- the value to find
- startIndex- the start index to traverse backwards from
- tolerance- search for value within plus/minus this amount
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value within the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to traverse backwards looking for the object, may be- null
- valueToFind- the object to find
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex will return 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
- valueToFind- the value to find
- startIndex- the start index to traverse backwards from
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value within the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to traverse backwards looking for the object, may be- null
- valueToFind- the object to find
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex will return 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
- valueToFind- the value to find
- startIndex- the start index to traverse backwards from
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value within the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to traverse backwards looking for the object, may be- null
- valueToFind- the object to find
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex will return 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
- valueToFind- the value to find
- startIndex- the start index to traverse backwards from
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given object within the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to traverse backwards looking for the object, may be- null
- objectToFind- the object to find, may be- null
- Returns:
- the last index of the object within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given object in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex will return 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
- objectToFind- the object to find, may be- null
- startIndex- the start index to traverse backwards from
- Returns:
- the last index of the object within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value within the array.This method returns INDEX_NOT_FOUND(-1) for anullinput array.- Parameters:
- array- the array to traverse backwards looking for the object, may be- null
- valueToFind- the object to find
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
lastIndexOfFinds the last index of the given value in the array starting at the given index.This method returns INDEX_NOT_FOUND(-1) for anullinput array.A negative startIndex will return 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
- valueToFind- the value to find
- startIndex- the start index to traverse backwards from
- Returns:
- the last index of the value within the array,
  INDEX_NOT_FOUND(-1) if not found ornullarray input
 
- 
newInstanceDelegates toArray.newInstance(Class,int)using generics.- Type Parameters:
- T- The array type.
- Parameters:
- componentType- The array class.
- length- the array length
- Returns:
- The new array.
- Throws:
- NullPointerException- if the specified- componentTypeparameter is null.
- Since:
- 3.13.0
 
- 
nullToDefensive programming technique to change anullreference to an empty one.This method returns a default array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Type Parameters:
- T- The array type.
- Parameters:
- array- the array to check for- nullor empty
- defaultArray- A default array, usually empty.
- Returns:
- the same array, or defaultArray if nullor empty input.
- Since:
- 3.15.0
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 3.2
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.As a memory optimizing technique an empty array passed in will be overridden with the empty public staticreferences in this class.- Parameters:
- array- the array to check for- nullor empty
- Returns:
- the same array, public staticempty array ifnullor empty input
- Since:
- 2.5
 
- 
nullToEmptyDefensive programming technique to change anullreference to an empty one.This method returns an empty array for a nullinput array.- Type Parameters:
- T- the class type
- Parameters:
- array- the array to check for- nullor empty
- type- the class representation of the desired array
- Returns:
- the same array, public staticempty array ifnull
- Throws:
- IllegalArgumentException- if the type argument is null
- Since:
- 3.5
 
- 
removeRemoves the element at the specified position from the specified array. All subsequent elements are shifted to the left (subtracts 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
- index- the position of the element to be removed
- Returns:
- A new array containing the existing elements except the element at 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
 
- 
removeRemoves the element at the specified position from the specified array. All subsequent elements are shifted to the left (subtracts 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
- index- the position of the element to be removed
- Returns:
- A new array containing the existing elements except the element at 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
 
- 
removeRemoves the element at the specified position from the specified array. All subsequent elements are shifted to the left (subtracts 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
- index- the position of the element to be removed
- Returns:
- A new array containing the existing elements except the element at 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
 
- 
removeRemoves the element at the specified position from the specified array. All subsequent elements are shifted to the left (subtracts 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
- index- the position of the element to be removed
- Returns:
- A new array containing the existing elements except the element at 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
 
- 
removeRemoves the element at the specified position from the specified array. All subsequent elements are shifted to the left (subtracts 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
- index- the position of the element to be removed
- Returns:
- A new array containing the existing elements except the element at 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
 
- 
removeRemoves the element at the specified position from the specified array. All subsequent elements are shifted to the left (subtracts 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
- index- the position of the element to be removed
- Returns:
- A new array containing the existing elements except the element at 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
 
- 
removeRemoves the element at the specified position from the specified array. All subsequent elements are shifted to the left (subtracts 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
- index- the position of the element to be removed
- Returns:
- A new array containing the existing elements except the element at 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
 
- 
removeRemoves the element at the specified position from the specified array. All subsequent elements are shifted to the left (subtracts 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
- index- the position of the element to be removed
- Returns:
- A new array containing the existing elements except the element at 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
 
- 
removeRemoves the element at the specified position from the specified array. All subsequent elements are shifted to the left (subtracts 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"] - Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array to remove the element from, may not be- null
- index- the position of the element to be removed
- Returns:
- A new array containing the existing elements except the element at 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
 
- 
removeAllRemoves the elements at the specified positions from the specified array. All remaining elements are shifted to the left.This method returns a new array with the same elements of the input array except those at the specified positions. 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.removeAll([true, false, true], 0, 2) = [false] ArrayUtils.removeAll([true, false, true], 1, 2) = [true] - Parameters:
- array- the array to remove the element from, may not be- null
- indices- the positions of the elements to be removed
- Returns:
- A new array containing the existing elements except those at the specified positions.
- Throws:
- IndexOutOfBoundsException- if any index is out of range (index < 0 || index >= array.length), or if the array is- null.
- Since:
- 3.0.1
 
- 
removeAllRemoves the elements at the specified positions from the specified array. All remaining elements are shifted to the left.This method returns a new array with the same elements of the input array except those at the specified positions. 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.removeAll([1], 0) = [] ArrayUtils.removeAll([2, 6], 0) = [6] ArrayUtils.removeAll([2, 6], 0, 1) = [] ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] - Parameters:
- array- the array to remove the element from, may not be- null
- indices- the positions of the elements to be removed
- Returns:
- A new array containing the existing elements except those at the specified positions.
- Throws:
- IndexOutOfBoundsException- if any index is out of range (index < 0 || index >= array.length), or if the array is- null.
- Since:
- 3.0.1
 
- 
removeAllRemoves the elements at the specified positions from the specified array. All remaining elements are shifted to the left.This method returns a new array with the same elements of the input array except those at the specified positions. 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.removeAll([1], 0) = [] ArrayUtils.removeAll([2, 6], 0) = [6] ArrayUtils.removeAll([2, 6], 0, 1) = [] ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] - Parameters:
- array- the array to remove the element from, may not be- null
- indices- the positions of the elements to be removed
- Returns:
- A new array containing the existing elements except those at the specified positions.
- Throws:
- IndexOutOfBoundsException- if any index is out of range (index < 0 || index >= array.length), or if the array is- null.
- Since:
- 3.0.1
 
- 
removeAllRemoves the elements at the specified positions from the specified array. All remaining elements are shifted to the left.This method returns a new array with the same elements of the input array except those at the specified positions. 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.removeAll([1], 0) = [] ArrayUtils.removeAll([2, 6], 0) = [6] ArrayUtils.removeAll([2, 6], 0, 1) = [] ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] - Parameters:
- array- the array to remove the element from, may not be- null
- indices- the positions of the elements to be removed
- Returns:
- A new array containing the existing elements except those at the specified positions.
- Throws:
- IndexOutOfBoundsException- if any index is out of range (index < 0 || index >= array.length), or if the array is- null.
- Since:
- 3.0.1
 
- 
removeAllRemoves the elements at the specified positions from the specified array. All remaining elements are shifted to the left.This method returns a new array with the same elements of the input array except those at the specified positions. 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.removeAll([1], 0) = [] ArrayUtils.removeAll([2, 6], 0) = [6] ArrayUtils.removeAll([2, 6], 0, 1) = [] ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] - Parameters:
- array- the array to remove the element from, may not be- null
- indices- the positions of the elements to be removed
- Returns:
- A new array containing the existing elements except those at the specified positions.
- Throws:
- IndexOutOfBoundsException- if any index is out of range (index < 0 || index >= array.length), or if the array is- null.
- Since:
- 3.0.1
 
- 
removeAllRemoves the elements at the specified positions from the specified array. All remaining elements are shifted to the left.This method returns a new array with the same elements of the input array except those at the specified positions. 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.removeAll([1], 0) = [] ArrayUtils.removeAll([2, 6], 0) = [6] ArrayUtils.removeAll([2, 6], 0, 1) = [] ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] - Parameters:
- array- the array to remove the element from, may not be- null
- indices- the positions of the elements to be removed
- Returns:
- A new array containing the existing elements except those at the specified positions.
- Throws:
- IndexOutOfBoundsException- if any index is out of range (index < 0 || index >= array.length), or if the array is- null.
- Since:
- 3.0.1
 
- 
removeAllRemoves the elements at the specified positions from the specified array. All remaining elements are shifted to the left.This method returns a new array with the same elements of the input array except those at the specified positions. 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.removeAll([1], 0) = [] ArrayUtils.removeAll([2, 6], 0) = [6] ArrayUtils.removeAll([2, 6], 0, 1) = [] ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] - Parameters:
- array- the array to remove the element from, may not be- null
- indices- the positions of the elements to be removed
- Returns:
- A new array containing the existing elements except those at the specified positions.
- Throws:
- IndexOutOfBoundsException- if any index is out of range (index < 0 || index >= array.length), or if the array is- null.
- Since:
- 3.0.1
 
- 
removeAllRemoves the elements at the specified positions from the specified array. All remaining elements are shifted to the left.This method returns a new array with the same elements of the input array except those at the specified positions. 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.removeAll([1], 0) = [] ArrayUtils.removeAll([2, 6], 0) = [6] ArrayUtils.removeAll([2, 6], 0, 1) = [] ArrayUtils.removeAll([2, 6, 3], 1, 2) = [2] ArrayUtils.removeAll([2, 6, 3], 0, 2) = [6] ArrayUtils.removeAll([2, 6, 3], 0, 1, 2) = [] - Parameters:
- array- the array to remove the element from, may not be- null
- indices- the positions of the elements to be removed
- Returns:
- A new array containing the existing elements except those at the specified positions.
- Throws:
- IndexOutOfBoundsException- if any index is out of range (index < 0 || index >= array.length), or if the array is- null.
- Since:
- 3.0.1
 
- 
removeAllRemoves the elements at the specified positions from the specified array. All remaining elements are shifted to the left.This method returns a new array with the same elements of the input array except those at the specified positions. 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.removeAll(["a", "b", "c"], 0, 2) = ["b"] ArrayUtils.removeAll(["a", "b", "c"], 1, 2) = ["a"] - Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array to remove the element from, may not be- null
- indices- the positions of the elements to be removed
- Returns:
- A new array containing the existing elements except those at the specified positions.
- Throws:
- IndexOutOfBoundsException- if any index is out of range (index < 0 || index >= array.length), or if the array is- null.
- Since:
- 3.0.1
 
- 
removeAllOccurencesDeprecated.Removes the occurrences of the specified element from the specified boolean array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.5
 
- 
removeAllOccurencesDeprecated.Removes the occurrences of the specified element from the specified byte array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.5
 
- 
removeAllOccurencesDeprecated.Removes the occurrences of the specified element from the specified char array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.5
 
- 
removeAllOccurencesDeprecated.Removes the occurrences of the specified element from the specified double array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.5
 
- 
removeAllOccurencesDeprecated.Removes the occurrences of the specified element from the specified float array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.5
 
- 
removeAllOccurencesDeprecated.Removes the occurrences of the specified element from the specified int array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.5
 
- 
removeAllOccurencesDeprecated.Removes the occurrences of the specified element from the specified long array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.5
 
- 
removeAllOccurencesDeprecated.Removes the occurrences of the specified element from the specified short array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.5
 
- 
removeAllOccurencesDeprecated.Removes the occurrences of the specified element from the specified array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Type Parameters:
- T- the type of object in the array
- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.5
 
- 
removeAllOccurrencesRemoves the occurrences of the specified element from the specified boolean array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.10
 
- 
removeAllOccurrencesRemoves the occurrences of the specified element from the specified byte array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.10
 
- 
removeAllOccurrencesRemoves the occurrences of the specified element from the specified char array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.10
 
- 
removeAllOccurrencesRemoves the occurrences of the specified element from the specified double array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.10
 
- 
removeAllOccurrencesRemoves the occurrences of the specified element from the specified float array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.10
 
- 
removeAllOccurrencesRemoves the occurrences of the specified element from the specified int array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.10
 
- 
removeAllOccurrencesRemoves the occurrences of the specified element from the specified long array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.10
 
- 
removeAllOccurrencesRemoves the occurrences of the specified element from the specified short array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.10
 
- 
removeAllOccurrencesRemoves the occurrences of the specified element from the specified array.All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain such an element, no elements are removed from the array. nullwill be returned if the input array isnull.- Type Parameters:
- T- the type of object in the array
- Parameters:
- element- the element to remove
- array- the input array
- Returns:
- A new array containing the existing elements except the occurrences of the specified element.
- Since:
- 3.10
 
- 
removeElementRemoves the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain 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
- element- the element to be removed
- Returns:
- A new array containing the existing elements except the first occurrence of the specified element.
- Since:
- 2.1
 
- 
removeElementRemoves the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain 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
- element- the element to be removed
- Returns:
- A new array containing the existing elements except the first occurrence of the specified element.
- Since:
- 2.1
 
- 
removeElementRemoves the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain 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
- element- the element to be removed
- Returns:
- A new array containing the existing elements except the first occurrence of the specified element.
- Since:
- 2.1
 
- 
removeElementRemoves the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain 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
- element- the element to be removed
- Returns:
- A new array containing the existing elements except the first occurrence of the specified element.
- Since:
- 2.1
 
- 
removeElementRemoves the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain 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
- element- the element to be removed
- Returns:
- A new array containing the existing elements except the first occurrence of the specified element.
- Since:
- 2.1
 
- 
removeElementRemoves the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain 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
- element- the element to be removed
- Returns:
- A new array containing the existing elements except the first occurrence of the specified element.
- Since:
- 2.1
 
- 
removeElementRemoves the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain 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
- element- the element to be removed
- Returns:
- A new array containing the existing elements except the first occurrence of the specified element.
- Since:
- 2.1
 
- 
removeElementRemoves the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain 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
- element- the element to be removed
- Returns:
- A new array containing the existing elements except the first occurrence of the specified element.
- Since:
- 2.1
 
- 
removeElementRemoves the first occurrence of the specified element from the specified array. All subsequent elements are shifted to the left (subtracts one from their indices). If the array doesn't contain 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"] - Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array to remove the element from, may be- null
- element- the element to be removed
- Returns:
- A new array containing the existing elements except the first occurrence of the specified element.
- Since:
- 2.1
 
- 
removeElementsRemoves occurrences of specified elements, in specified quantities, from the specified array. All subsequent elements are shifted left. For any element-to-be-removed specified in greater quantities than contained in the original array, no change occurs beyond the removal of the existing matching items.This method returns a new array with the same elements of the input array except for the earliest-encountered occurrences of the specified elements. The component type of the returned array is always the same as that of the input array. ArrayUtils.removeElements(null, true, false) = null ArrayUtils.removeElements([], true, false) = [] ArrayUtils.removeElements([true], false, false) = [true] ArrayUtils.removeElements([true, false], true, true) = [false] ArrayUtils.removeElements([true, false, true], true) = [false, true] ArrayUtils.removeElements([true, false, true], true, true) = [false] - Parameters:
- array- the array to remove the element from, may be- null
- values- the elements to be removed
- Returns:
- A new array containing the existing elements except the earliest-encountered occurrences of the specified elements.
- Since:
- 3.0.1
 
- 
removeElementsRemoves occurrences of specified elements, in specified quantities, from the specified array. All subsequent elements are shifted left. For any element-to-be-removed specified in greater quantities than contained in the original array, no change occurs beyond the removal of the existing matching items.This method returns a new array with the same elements of the input array except for the earliest-encountered occurrences of the specified elements. The component type of the returned array is always the same as that of the input array. ArrayUtils.removeElements(null, 1, 2) = null ArrayUtils.removeElements([], 1, 2) = [] ArrayUtils.removeElements([1], 2, 3) = [1] ArrayUtils.removeElements([1, 3], 1, 2) = [3] ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] - Parameters:
- array- the array to remove the element from, may be- null
- values- the elements to be removed
- Returns:
- A new array containing the existing elements except the earliest-encountered occurrences of the specified elements.
- Since:
- 3.0.1
 
- 
removeElementsRemoves occurrences of specified elements, in specified quantities, from the specified array. All subsequent elements are shifted left. For any element-to-be-removed specified in greater quantities than contained in the original array, no change occurs beyond the removal of the existing matching items.This method returns a new array with the same elements of the input array except for the earliest-encountered occurrences of the specified elements. The component type of the returned array is always the same as that of the input array. ArrayUtils.removeElements(null, 1, 2) = null ArrayUtils.removeElements([], 1, 2) = [] ArrayUtils.removeElements([1], 2, 3) = [1] ArrayUtils.removeElements([1, 3], 1, 2) = [3] ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] - Parameters:
- array- the array to remove the element from, may be- null
- values- the elements to be removed
- Returns:
- A new array containing the existing elements except the earliest-encountered occurrences of the specified elements.
- Since:
- 3.0.1
 
- 
removeElementsRemoves occurrences of specified elements, in specified quantities, from the specified array. All subsequent elements are shifted left. For any element-to-be-removed specified in greater quantities than contained in the original array, no change occurs beyond the removal of the existing matching items.This method returns a new array with the same elements of the input array except for the earliest-encountered occurrences of the specified elements. The component type of the returned array is always the same as that of the input array. ArrayUtils.removeElements(null, 1, 2) = null ArrayUtils.removeElements([], 1, 2) = [] ArrayUtils.removeElements([1], 2, 3) = [1] ArrayUtils.removeElements([1, 3], 1, 2) = [3] ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] - Parameters:
- array- the array to remove the element from, may be- null
- values- the elements to be removed
- Returns:
- A new array containing the existing elements except the earliest-encountered occurrences of the specified elements.
- Since:
- 3.0.1
 
- 
removeElementsRemoves occurrences of specified elements, in specified quantities, from the specified array. All subsequent elements are shifted left. For any element-to-be-removed specified in greater quantities than contained in the original array, no change occurs beyond the removal of the existing matching items.This method returns a new array with the same elements of the input array except for the earliest-encountered occurrences of the specified elements. The component type of the returned array is always the same as that of the input array. ArrayUtils.removeElements(null, 1, 2) = null ArrayUtils.removeElements([], 1, 2) = [] ArrayUtils.removeElements([1], 2, 3) = [1] ArrayUtils.removeElements([1, 3], 1, 2) = [3] ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] - Parameters:
- array- the array to remove the element from, may be- null
- values- the elements to be removed
- Returns:
- A new array containing the existing elements except the earliest-encountered occurrences of the specified elements.
- Since:
- 3.0.1
 
- 
removeElementsRemoves occurrences of specified elements, in specified quantities, from the specified array. All subsequent elements are shifted left. For any element-to-be-removed specified in greater quantities than contained in the original array, no change occurs beyond the removal of the existing matching items.This method returns a new array with the same elements of the input array except for the earliest-encountered occurrences of the specified elements. The component type of the returned array is always the same as that of the input array. ArrayUtils.removeElements(null, 1, 2) = null ArrayUtils.removeElements([], 1, 2) = [] ArrayUtils.removeElements([1], 2, 3) = [1] ArrayUtils.removeElements([1, 3], 1, 2) = [3] ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] - Parameters:
- array- the array to remove the element from, may be- null
- values- the elements to be removed
- Returns:
- A new array containing the existing elements except the earliest-encountered occurrences of the specified elements.
- Since:
- 3.0.1
 
- 
removeElementsRemoves occurrences of specified elements, in specified quantities, from the specified array. All subsequent elements are shifted left. For any element-to-be-removed specified in greater quantities than contained in the original array, no change occurs beyond the removal of the existing matching items.This method returns a new array with the same elements of the input array except for the earliest-encountered occurrences of the specified elements. The component type of the returned array is always the same as that of the input array. ArrayUtils.removeElements(null, 1, 2) = null ArrayUtils.removeElements([], 1, 2) = [] ArrayUtils.removeElements([1], 2, 3) = [1] ArrayUtils.removeElements([1, 3], 1, 2) = [3] ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] - Parameters:
- array- the array to remove the element from, may be- null
- values- the elements to be removed
- Returns:
- A new array containing the existing elements except the earliest-encountered occurrences of the specified elements.
- Since:
- 3.0.1
 
- 
removeElementsRemoves occurrences of specified elements, in specified quantities, from the specified array. All subsequent elements are shifted left. For any element-to-be-removed specified in greater quantities than contained in the original array, no change occurs beyond the removal of the existing matching items.This method returns a new array with the same elements of the input array except for the earliest-encountered occurrences of the specified elements. The component type of the returned array is always the same as that of the input array. ArrayUtils.removeElements(null, 1, 2) = null ArrayUtils.removeElements([], 1, 2) = [] ArrayUtils.removeElements([1], 2, 3) = [1] ArrayUtils.removeElements([1, 3], 1, 2) = [3] ArrayUtils.removeElements([1, 3, 1], 1) = [3, 1] ArrayUtils.removeElements([1, 3, 1], 1, 1) = [3] - Parameters:
- array- the array to remove the element from, may be- null
- values- the elements to be removed
- Returns:
- A new array containing the existing elements except the earliest-encountered occurrences of the specified elements.
- Since:
- 3.0.1
 
- 
removeElementsRemoves occurrences of specified elements, in specified quantities, from the specified array. All subsequent elements are shifted left. For any element-to-be-removed specified in greater quantities than contained in the original array, no change occurs beyond the removal of the existing matching items.This method returns a new array with the same elements of the input array except for the earliest-encountered occurrences of the specified elements. The component type of the returned array is always the same as that of the input array. ArrayUtils.removeElements(null, "a", "b") = null ArrayUtils.removeElements([], "a", "b") = [] ArrayUtils.removeElements(["a"], "b", "c") = ["a"] ArrayUtils.removeElements(["a", "b"], "a", "c") = ["b"] ArrayUtils.removeElements(["a", "b", "a"], "a") = ["b", "a"] ArrayUtils.removeElements(["a", "b", "a"], "a", "a") = ["b"] - Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array to remove the element from, may be- null
- values- the elements to be removed
- Returns:
- A new array containing the existing elements except the earliest-encountered occurrences of the specified elements.
- Since:
- 3.0.1
 
- 
reverseReverses the order of the given array.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
 
- 
reverseReverses the order of the given array in the given range.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are reversed in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- Since:
- 3.2
 
- 
reverseReverses the order of the given array.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
 
- 
reverseReverses the order of the given array in the given range.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are reversed in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- Since:
- 3.2
 
- 
reverseReverses the order of the given array.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
 
- 
reverseReverses the order of the given array in the given range.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are reversed in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- Since:
- 3.2
 
- 
reverseReverses the order of the given array.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
 
- 
reverseReverses the order of the given array in the given range.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are reversed in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- Since:
- 3.2
 
- 
reverseReverses the order of the given array.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
 
- 
reverseReverses the order of the given array in the given range.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are reversed in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- Since:
- 3.2
 
- 
reverseReverses the order of the given array.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
 
- 
reverseReverses the order of the given array in the given range.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are reversed in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- Since:
- 3.2
 
- 
reverseReverses the order of the given array.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
 
- 
reverseReverses the order of the given array in the given range.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are reversed in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- Since:
- 3.2
 
- 
reverseReverses the order of the given array.There is no special handling for multi-dimensional arrays. This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
 
- 
reverseReverses the order of the given array in the given range.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
- startIndexInclusive- the starting index. Under value (<0) is promoted to 0, over value (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are reversed in the array. Under value (< start index) results in no change. Over value (>array.length) is demoted to array length.
- Since:
- 3.2
 
- 
reverseReverses the order of the given array.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
 
- 
reverseReverses the order of the given array in the given range.This method does nothing for a nullinput array.- Parameters:
- array- the array to reverse, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are reversed in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- Since:
- 3.2
 
- 
setAllSets all elements of the specified array, using the provided generator supplier to compute each element.If the generator supplier throws an exception, it is relayed to the caller and the array is left in an indeterminate state. - Type Parameters:
- T- type of elements of the array.
- Parameters:
- array- array to be initialized.
- generator- a function accepting an index and producing the desired value for that position.
- Returns:
- the input array
- Since:
- 3.13.0
 
- 
setAllSets all elements of the specified array, using the provided generator supplier to compute each element.If the generator supplier throws an exception, it is relayed to the caller and the array is left in an indeterminate state. - Type Parameters:
- T- type of elements of the array.
- Parameters:
- array- array to be initialized.
- generator- a function accepting an index and producing the desired value for that position.
- Returns:
- the input array
- Since:
- 3.13.0
 
- 
shiftShifts the order of the given boolean array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftpublic static void shift(boolean[] array, int startIndexInclusive, int endIndexExclusive, int offset) Shifts the order of a series of elements in the given boolean array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of the given byte array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of a series of elements in the given byte array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of the given char array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of a series of elements in the given char array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of the given double array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftpublic static void shift(double[] array, int startIndexInclusive, int endIndexExclusive, int offset) Shifts the order of a series of elements in the given double array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of the given float array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of a series of elements in the given float array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of the given int array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of a series of elements in the given int array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of the given long array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of a series of elements in the given long array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of the given array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftpublic static void shift(Object[] array, int startIndexInclusive, int endIndexExclusive, int offset) Shifts the order of a series of elements in the given array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of the given short array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shiftShifts the order of a series of elements in the given short array.There is no special handling for multi-dimensional arrays. This method does nothing for nullor empty input arrays.- Parameters:
- array- the array to shift, may be- null
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in no change.
- endIndexExclusive- elements up to endIndex-1 are shifted in the array. Undervalue (< start index) results in no change. Overvalue (>array.length) is demoted to array length.
- offset- The number of positions to rotate the elements. If the offset is larger than the number of elements to rotate, than the effective offset is modulo the number of elements to rotate.
- Since:
- 3.5
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- random- the source of randomness used to permute the elements
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- random- the source of randomness used to permute the elements
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- random- the source of randomness used to permute the elements
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- random- the source of randomness used to permute the elements
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- random- the source of randomness used to permute the elements
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- random- the source of randomness used to permute the elements
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- random- the source of randomness used to permute the elements
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- random- the source of randomness used to permute the elements
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- Since:
- 3.6
- See Also:
 
- 
shuffleRandomly permutes the elements of the specified array using the Fisher-Yates algorithm.- Parameters:
- array- the array to shuffle
- random- the source of randomness used to permute the elements
- Since:
- 3.6
- See Also:
 
- 
subarrayProduces a newbooleanarray 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
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
- endIndexExclusive- elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
- Returns:
- a new array containing the elements between the start and end indices.
- Since:
- 2.1
- See Also:
 
- 
subarrayProduces a newbytearray 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
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
- endIndexExclusive- elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
- Returns:
- a new array containing the elements between the start and end indices.
- Since:
- 2.1
- See Also:
 
- 
subarrayProduces a newchararray 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
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
- endIndexExclusive- elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
- Returns:
- a new array containing the elements between the start and end indices.
- Since:
- 2.1
- See Also:
 
- 
subarrayProduces a newdoublearray 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
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
- endIndexExclusive- elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
- Returns:
- a new array containing the elements between the start and end indices.
- Since:
- 2.1
- See Also:
 
- 
subarrayProduces a newfloatarray 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
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
- endIndexExclusive- elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
- Returns:
- a new array containing the elements between the start and end indices.
- Since:
- 2.1
- See Also:
 
- 
subarrayProduces a newintarray 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
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
- endIndexExclusive- elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
- Returns:
- a new array containing the elements between the start and end indices.
- Since:
- 2.1
- See Also:
 
- 
subarrayProduces a newlongarray 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
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
- endIndexExclusive- elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
- Returns:
- a new array containing the elements between the start and end indices.
- Since:
- 2.1
- See Also:
 
- 
subarrayProduces a newshortarray 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
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
- endIndexExclusive- elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
- Returns:
- a new array containing the elements between the start and end indices.
- Since:
- 2.1
- See Also:
 
- 
subarrayProduces 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); - Type Parameters:
- T- the component type of the array
- Parameters:
- array- the array
- startIndexInclusive- the starting index. Undervalue (<0) is promoted to 0, overvalue (>array.length) results in an empty array.
- endIndexExclusive- elements up to endIndex-1 are present in the returned subarray. Undervalue (< startIndex) produces empty array, overvalue (>array.length) is demoted to array length.
- Returns:
- a new array containing the elements between the start and end indices.
- Since:
- 2.1
- See Also:
 
- 
swapSwaps two elements in the given boolean array.There is no special handling for multi-dimensional arrays. This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero).- ArrayUtils.swap([1, 2, 3], 0, 2) -> [3, 2, 1]
- ArrayUtils.swap([1, 2, 3], 0, 0) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], 1, 0) -> [2, 1, 3]
- ArrayUtils.swap([1, 2, 3], 0, 5) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], -1, 1) -> [2, 1, 3]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element to swap
- offset2- the index of the second element to swap
- Since:
- 3.5
 
- 
swapSwaps a series of elements in the given boolean array.This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero). If any of the sub-arrays to swap falls outside of the given array, then the swap is stopped at the end of the array and as many as possible elements are swapped.- ArrayUtils.swap([true, false, true, false], 0, 2, 1) -> [true, false, true, false]
- ArrayUtils.swap([true, false, true, false], 0, 0, 1) -> [true, false, true, false]
- ArrayUtils.swap([true, false, true, false], 0, 2, 2) -> [true, false, true, false]
- ArrayUtils.swap([true, false, true, false], -3, 2, 2) -> [true, false, true, false]
- ArrayUtils.swap([true, false, true, false], 0, 3, 3) -> [false, false, true, true]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element in the series to swap
- offset2- the index of the second element in the series to swap
- len- the number of elements to swap starting with the given indices
- Since:
- 3.5
 
- 
swapSwaps two elements in the given byte array.There is no special handling for multi-dimensional arrays. This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero).- ArrayUtils.swap([1, 2, 3], 0, 2) -> [3, 2, 1]
- ArrayUtils.swap([1, 2, 3], 0, 0) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], 1, 0) -> [2, 1, 3]
- ArrayUtils.swap([1, 2, 3], 0, 5) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], -1, 1) -> [2, 1, 3]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element to swap
- offset2- the index of the second element to swap
- Since:
- 3.5
 
- 
swapSwaps a series of elements in the given byte array.This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero). If any of the sub-arrays to swap falls outside of the given array, then the swap is stopped at the end of the array and as many as possible elements are swapped.- ArrayUtils.swap([1, 2, 3, 4], 0, 2, 1) -> [3, 2, 1, 4]
- ArrayUtils.swap([1, 2, 3, 4], 0, 0, 1) -> [1, 2, 3, 4]
- ArrayUtils.swap([1, 2, 3, 4], 2, 0, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], -3, 2, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], 0, 3, 3) -> [4, 2, 3, 1]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element in the series to swap
- offset2- the index of the second element in the series to swap
- len- the number of elements to swap starting with the given indices
- Since:
- 3.5
 
- 
swapSwaps two elements in the given char array.There is no special handling for multi-dimensional arrays. This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero).- ArrayUtils.swap([1, 2, 3], 0, 2) -> [3, 2, 1]
- ArrayUtils.swap([1, 2, 3], 0, 0) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], 1, 0) -> [2, 1, 3]
- ArrayUtils.swap([1, 2, 3], 0, 5) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], -1, 1) -> [2, 1, 3]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element to swap
- offset2- the index of the second element to swap
- Since:
- 3.5
 
- 
swapSwaps a series of elements in the given char array.This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero). If any of the sub-arrays to swap falls outside of the given array, then the swap is stopped at the end of the array and as many as possible elements are swapped.- ArrayUtils.swap([1, 2, 3, 4], 0, 2, 1) -> [3, 2, 1, 4]
- ArrayUtils.swap([1, 2, 3, 4], 0, 0, 1) -> [1, 2, 3, 4]
- ArrayUtils.swap([1, 2, 3, 4], 2, 0, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], -3, 2, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], 0, 3, 3) -> [4, 2, 3, 1]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element in the series to swap
- offset2- the index of the second element in the series to swap
- len- the number of elements to swap starting with the given indices
- Since:
- 3.5
 
- 
swapSwaps two elements in the given double array.There is no special handling for multi-dimensional arrays. This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero).- ArrayUtils.swap([1, 2, 3], 0, 2) -> [3, 2, 1]
- ArrayUtils.swap([1, 2, 3], 0, 0) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], 1, 0) -> [2, 1, 3]
- ArrayUtils.swap([1, 2, 3], 0, 5) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], -1, 1) -> [2, 1, 3]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element to swap
- offset2- the index of the second element to swap
- Since:
- 3.5
 
- 
swapSwaps a series of elements in the given double array.This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero). If any of the sub-arrays to swap falls outside of the given array, then the swap is stopped at the end of the array and as many as possible elements are swapped.- ArrayUtils.swap([1, 2, 3, 4], 0, 2, 1) -> [3, 2, 1, 4]
- ArrayUtils.swap([1, 2, 3, 4], 0, 0, 1) -> [1, 2, 3, 4]
- ArrayUtils.swap([1, 2, 3, 4], 2, 0, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], -3, 2, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], 0, 3, 3) -> [4, 2, 3, 1]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element in the series to swap
- offset2- the index of the second element in the series to swap
- len- the number of elements to swap starting with the given indices
- Since:
- 3.5
 
- 
swapSwaps two elements in the given float array.There is no special handling for multi-dimensional arrays. This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero).- ArrayUtils.swap([1, 2, 3], 0, 2) -> [3, 2, 1]
- ArrayUtils.swap([1, 2, 3], 0, 0) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], 1, 0) -> [2, 1, 3]
- ArrayUtils.swap([1, 2, 3], 0, 5) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], -1, 1) -> [2, 1, 3]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element to swap
- offset2- the index of the second element to swap
- Since:
- 3.5
 
- 
swapSwaps a series of elements in the given float array.This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero). If any of the sub-arrays to swap falls outside of the given array, then the swap is stopped at the end of the array and as many as possible elements are swapped.- ArrayUtils.swap([1, 2, 3, 4], 0, 2, 1) -> [3, 2, 1, 4]
- ArrayUtils.swap([1, 2, 3, 4], 0, 0, 1) -> [1, 2, 3, 4]
- ArrayUtils.swap([1, 2, 3, 4], 2, 0, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], -3, 2, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], 0, 3, 3) -> [4, 2, 3, 1]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element in the series to swap
- offset2- the index of the second element in the series to swap
- len- the number of elements to swap starting with the given indices
- Since:
- 3.5
 
- 
swapSwaps two elements in the given int array.There is no special handling for multi-dimensional arrays. This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero).- ArrayUtils.swap([1, 2, 3], 0, 2) -> [3, 2, 1]
- ArrayUtils.swap([1, 2, 3], 0, 0) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], 1, 0) -> [2, 1, 3]
- ArrayUtils.swap([1, 2, 3], 0, 5) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], -1, 1) -> [2, 1, 3]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element to swap
- offset2- the index of the second element to swap
- Since:
- 3.5
 
- 
swapSwaps a series of elements in the given int array.This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero). If any of the sub-arrays to swap falls outside of the given array, then the swap is stopped at the end of the array and as many as possible elements are swapped.- ArrayUtils.swap([1, 2, 3, 4], 0, 2, 1) -> [3, 2, 1, 4]
- ArrayUtils.swap([1, 2, 3, 4], 0, 0, 1) -> [1, 2, 3, 4]
- ArrayUtils.swap([1, 2, 3, 4], 2, 0, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], -3, 2, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], 0, 3, 3) -> [4, 2, 3, 1]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element in the series to swap
- offset2- the index of the second element in the series to swap
- len- the number of elements to swap starting with the given indices
- Since:
- 3.5
 
- 
swapSwaps two elements in the given long array.There is no special handling for multi-dimensional arrays. This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero).- ArrayUtils.swap([true, false, true], 0, 2) -> [true, false, true]
- ArrayUtils.swap([true, false, true], 0, 0) -> [true, false, true]
- ArrayUtils.swap([true, false, true], 1, 0) -> [false, true, true]
- ArrayUtils.swap([true, false, true], 0, 5) -> [true, false, true]
- ArrayUtils.swap([true, false, true], -1, 1) -> [false, true, true]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element to swap
- offset2- the index of the second element to swap
- Since:
- 3.5
 
- 
swapSwaps a series of elements in the given long array.This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero). If any of the sub-arrays to swap falls outside of the given array, then the swap is stopped at the end of the array and as many as possible elements are swapped.- ArrayUtils.swap([1, 2, 3, 4], 0, 2, 1) -> [3, 2, 1, 4]
- ArrayUtils.swap([1, 2, 3, 4], 0, 0, 1) -> [1, 2, 3, 4]
- ArrayUtils.swap([1, 2, 3, 4], 2, 0, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], -3, 2, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], 0, 3, 3) -> [4, 2, 3, 1]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element in the series to swap
- offset2- the index of the second element in the series to swap
- len- the number of elements to swap starting with the given indices
- Since:
- 3.5
 
- 
swapSwaps two elements in the given array.There is no special handling for multi-dimensional arrays. This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero).- ArrayUtils.swap(["1", "2", "3"], 0, 2) -> ["3", "2", "1"]
- ArrayUtils.swap(["1", "2", "3"], 0, 0) -> ["1", "2", "3"]
- ArrayUtils.swap(["1", "2", "3"], 1, 0) -> ["2", "1", "3"]
- ArrayUtils.swap(["1", "2", "3"], 0, 5) -> ["1", "2", "3"]
- ArrayUtils.swap(["1", "2", "3"], -1, 1) -> ["2", "1", "3"]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element to swap
- offset2- the index of the second element to swap
- Since:
- 3.5
 
- 
swapSwaps a series of elements in the given array.This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero). If any of the sub-arrays to swap falls outside of the given array, then the swap is stopped at the end of the array and as many as possible elements are swapped.- ArrayUtils.swap(["1", "2", "3", "4"], 0, 2, 1) -> ["3", "2", "1", "4"]
- ArrayUtils.swap(["1", "2", "3", "4"], 0, 0, 1) -> ["1", "2", "3", "4"]
- ArrayUtils.swap(["1", "2", "3", "4"], 2, 0, 2) -> ["3", "4", "1", "2"]
- ArrayUtils.swap(["1", "2", "3", "4"], -3, 2, 2) -> ["3", "4", "1", "2"]
- ArrayUtils.swap(["1", "2", "3", "4"], 0, 3, 3) -> ["4", "2", "3", "1"]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element in the series to swap
- offset2- the index of the second element in the series to swap
- len- the number of elements to swap starting with the given indices
- Since:
- 3.5
 
- 
swapSwaps two elements in the given short array.There is no special handling for multi-dimensional arrays. This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero).- ArrayUtils.swap([1, 2, 3], 0, 2) -> [3, 2, 1]
- ArrayUtils.swap([1, 2, 3], 0, 0) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], 1, 0) -> [2, 1, 3]
- ArrayUtils.swap([1, 2, 3], 0, 5) -> [1, 2, 3]
- ArrayUtils.swap([1, 2, 3], -1, 1) -> [2, 1, 3]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element to swap
- offset2- the index of the second element to swap
- Since:
- 3.5
 
- 
swapSwaps a series of elements in the given short array.This method does nothing for a Examples:nullor empty input array or for overflow indices. Negative indices are promoted to 0(zero). If any of the sub-arrays to swap falls outside of the given array, then the swap is stopped at the end of the array and as many as possible elements are swapped.- ArrayUtils.swap([1, 2, 3, 4], 0, 2, 1) -> [3, 2, 1, 4]
- ArrayUtils.swap([1, 2, 3, 4], 0, 0, 1) -> [1, 2, 3, 4]
- ArrayUtils.swap([1, 2, 3, 4], 2, 0, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], -3, 2, 2) -> [3, 4, 1, 2]
- ArrayUtils.swap([1, 2, 3, 4], 0, 3, 3) -> [4, 2, 3, 1]
 - Parameters:
- array- the array to swap, may be- null
- offset1- the index of the first element in the series to swap
- offset2- the index of the second element in the series to swap
- len- the number of elements to swap starting with the given indices
- Since:
- 3.5
 
- 
toArrayCreate a type-safe generic array.The Java language does not allow an array to be created from a generic type: public static <T> T[] createAnArray(int size) { return new T[size]; // compiler error here } public static <T> T[] createAnArray(int size) { return (T[]) new Object[size]; // ClassCastException at runtime }Therefore new arrays of generic types can be created with this method. For example, an array of Strings can be created: String[] array = ArrayUtils.toArray("1", "2"); String[] emptyArray = ArrayUtils.<String>toArray();The method is typically used in scenarios, where the caller itself uses generic types that have to be combined into an array. Note, this method makes only sense to provide arguments of the same type so that the compiler can deduce the type of the array itself. While it is possible to select the type explicitly like in Number[] array = ArrayUtils.<Number>toArray(Integer.valueOf(42), Double.valueOf(Math.PI)), there is no real advantage when compared tonew Number[] {Integer.valueOf(42), Double.valueOf(Math.PI)}.- Type Parameters:
- T- the array's element type
- Parameters:
- items- the varargs array items, null allowed
- Returns:
- the array, not null unless a null array is passed in
- Since:
- 3.0
 
- 
toMapConverts the given array into aMap. Each element of the array must be either aMap.Entryor 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 = ArrayUtils.toMap(new String[][] { {"RED", "#FF0000"}, {"GREEN", "#00FF00"}, {"BLUE", "#0000FF"}});This method returns nullfor anullinput array.- Parameters:
- array- an array whose elements are either a- Map.Entryor an Array containing at least two elements, may be- null
- Returns:
- a Mapthat was created from the array
- Throws:
- IllegalArgumentException- if one element of this Array is itself an Array containing less than two elements
- IllegalArgumentException- if the array contains elements other than- Map.Entryand an Array
 
- 
toObjectConverts an array of primitive booleans to objects.This method returns nullfor anullinput array.- Parameters:
- array- a- booleanarray
- Returns:
- a Booleanarray,nullif null array input
 
- 
toObjectConverts an array of primitive bytes to objects.This method returns nullfor anullinput array.- Parameters:
- array- a- bytearray
- Returns:
- a Bytearray,nullif null array input
 
- 
toObjectConverts an array of primitive chars to objects.This method returns nullfor anullinput array.- Parameters:
- array- a- chararray
- Returns:
- a Characterarray,nullif null array input
 
- 
toObjectConverts an array of primitive doubles to objects.This method returns nullfor anullinput array.- Parameters:
- array- a- doublearray
- Returns:
- a Doublearray,nullif null array input
 
- 
toObjectConverts an array of primitive floats to objects.This method returns nullfor anullinput array.- Parameters:
- array- a- floatarray
- Returns:
- a Floatarray,nullif null array input
 
- 
toObjectConverts an array of primitive ints to objects.This method returns nullfor anullinput array.- Parameters:
- array- an- intarray
- Returns:
- an Integerarray,nullif null array input
 
- 
toObjectConverts an array of primitive longs to objects.This method returns nullfor anullinput array.- Parameters:
- array- a- longarray
- Returns:
- a Longarray,nullif null array input
 
- 
toObjectConverts an array of primitive shorts to objects.This method returns nullfor anullinput array.- Parameters:
- array- a- shortarray
- Returns:
- a Shortarray,nullif null array input
 
- 
toPrimitiveConverts an array of object Booleans to primitives.This method returns nullfor anullinput array.Null array elements map to false, like Boolean.parseBoolean(null)and its callers return false.- Parameters:
- array- a- Booleanarray, may be- null
- Returns:
- a booleanarray,nullif null array input
 
- 
toPrimitiveConverts an array of object Booleans to primitives handlingnull.This method returns nullfor anullinput array.- Parameters:
- array- a- Booleanarray, may be- null
- valueForNull- the value to insert if- nullfound
- Returns:
- a booleanarray,nullif null array input
 
- 
toPrimitiveConverts an array of object Bytes to primitives.This method returns nullfor anullinput array.- Parameters:
- array- a- Bytearray, may be- null
- Returns:
- a bytearray,nullif null array input
- Throws:
- NullPointerException- if an array element is- null
 
- 
toPrimitiveConverts an array of object Bytes to primitives handlingnull.This method returns nullfor anullinput array.- Parameters:
- array- a- Bytearray, may be- null
- valueForNull- the value to insert if- nullfound
- Returns:
- a bytearray,nullif null array input
 
- 
toPrimitiveConverts an array of object Characters to primitives.This method returns nullfor anullinput array.- Parameters:
- array- a- Characterarray, may be- null
- Returns:
- a chararray,nullif null array input
- Throws:
- NullPointerException- if an array element is- null
 
- 
toPrimitiveConverts an array of object Character to primitives handlingnull.This method returns nullfor anullinput array.- Parameters:
- array- a- Characterarray, may be- null
- valueForNull- the value to insert if- nullfound
- Returns:
- a chararray,nullif null array input
 
- 
toPrimitiveConverts an array of object Doubles to primitives.This method returns nullfor anullinput array.- Parameters:
- array- a- Doublearray, may be- null
- Returns:
- a doublearray,nullif null array input
- Throws:
- NullPointerException- if an array element is- null
 
- 
toPrimitiveConverts an array of object Doubles to primitives handlingnull.This method returns nullfor anullinput array.- Parameters:
- array- a- Doublearray, may be- null
- valueForNull- the value to insert if- nullfound
- Returns:
- a doublearray,nullif null array input
 
- 
toPrimitiveConverts an array of object Floats to primitives.This method returns nullfor anullinput array.- Parameters:
- array- a- Floatarray, may be- null
- Returns:
- a floatarray,nullif null array input
- Throws:
- NullPointerException- if an array element is- null
 
- 
toPrimitiveConverts an array of object Floats to primitives handlingnull.This method returns nullfor anullinput array.- Parameters:
- array- a- Floatarray, may be- null
- valueForNull- the value to insert if- nullfound
- Returns:
- a floatarray,nullif null array input
 
- 
toPrimitiveConverts an array of object Integers to primitives.This method returns nullfor anullinput array.- Parameters:
- array- a- Integerarray, may be- null
- Returns:
- an intarray,nullif null array input
- Throws:
- NullPointerException- if an array element is- null
 
- 
toPrimitiveConverts an array of object Integer to primitives handlingnull.This method returns nullfor anullinput array.- Parameters:
- array- a- Integerarray, may be- null
- valueForNull- the value to insert if- nullfound
- Returns:
- an intarray,nullif null array input
 
- 
toPrimitiveConverts an array of object Longs to primitives.This method returns nullfor anullinput array.- Parameters:
- array- a- Longarray, may be- null
- Returns:
- a longarray,nullif null array input
- Throws:
- NullPointerException- if an array element is- null
 
- 
toPrimitiveConverts an array of object Long to primitives handlingnull.This method returns nullfor anullinput array.- Parameters:
- array- a- Longarray, may be- null
- valueForNull- the value to insert if- nullfound
- Returns:
- a longarray,nullif null array input
 
- 
toPrimitiveCreate an array of primitive type from an array of wrapper types.This method returns nullfor anullinput array.- Parameters:
- array- an array of wrapper object
- Returns:
- an array of the corresponding primitive type, or the original array
- Since:
- 3.5
 
- 
toPrimitiveConverts an array of object Shorts to primitives.This method returns nullfor anullinput array.- Parameters:
- array- a- Shortarray, may be- null
- Returns:
- a bytearray,nullif null array input
- Throws:
- NullPointerException- if an array element is- null
 
- 
toPrimitiveConverts an array of object Short to primitives handlingnull.This method returns nullfor anullinput array.- Parameters:
- array- a- Shortarray, may be- null
- valueForNull- the value to insert if- nullfound
- Returns:
- a bytearray,nullif null array input
 
- 
toStringOutputs an array as a String, treatingnullas 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
- Returns:
- a String representation of the array, '{}' if null array input
 
- 
toStringOutputs an array as a String handlingnulls.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
- stringIfNull- the String to return if the array is- null
- Returns:
- a String representation of the array
 
- 
toStringArrayReturns an array containing the string representation of each element in the argument array.This method returns nullfor anullinput array.- Parameters:
- array- the- Object[]to be processed, may be null
- Returns:
- String[]of the same size as the source with its element's string representation,- nullif null array input
- Throws:
- NullPointerException- if an array element is- null
- Since:
- 3.6
 
- 
toStringArrayReturns an array containing the string representation of each element in the argument array handlingnullelements.This method returns nullfor anullinput array.- Parameters:
- array- the Object[] to be processed, may be null
- valueForNullElements- the value to insert if- nullis found
- Returns:
- a Stringarray,nullif null array input
- Since:
- 3.6
 
 
-