-
public class ArrayUtilsOperations on arrays, primitive arrays (like
{@code int[]}) and primitive wrapper arrays (like{@code Integer[]}).This class tries to handle
{@code null}input gracefully. An exception will not be thrown for a{@code null}array input. However, an Object array that contains a{@code null}element may throw an exception. Each method documents its behaviour.#ThreadSafe#
-
-
Field Summary
Fields Modifier and Type Field Description public final static Array<Object>EMPTY_OBJECT_ARRAYpublic final static Array<Class<out Object>>EMPTY_CLASS_ARRAYpublic final static Array<String>EMPTY_STRING_ARRAYpublic final static Array<long>EMPTY_LONG_ARRAYpublic final static Array<Long>EMPTY_LONG_OBJECT_ARRAYpublic final static Array<int>EMPTY_INT_ARRAYpublic final static Array<Integer>EMPTY_INTEGER_OBJECT_ARRAYpublic final static Array<short>EMPTY_SHORT_ARRAYpublic final static Array<Short>EMPTY_SHORT_OBJECT_ARRAYpublic final static Array<byte>EMPTY_BYTE_ARRAYpublic final static Array<Byte>EMPTY_BYTE_OBJECT_ARRAYpublic final static Array<double>EMPTY_DOUBLE_ARRAYpublic final static Array<Double>EMPTY_DOUBLE_OBJECT_ARRAYpublic final static Array<float>EMPTY_FLOAT_ARRAYpublic final static Array<Float>EMPTY_FLOAT_OBJECT_ARRAYpublic final static Array<boolean>EMPTY_BOOLEAN_ARRAYpublic final static Array<Boolean>EMPTY_BOOLEAN_OBJECT_ARRAYpublic final static Array<char>EMPTY_CHAR_ARRAYpublic final static Array<Character>EMPTY_CHARACTER_OBJECT_ARRAYpublic final static intINDEX_NOT_FOUND
-
Constructor Summary
Constructors Constructor Description ArrayUtils()ArrayUtils instances should NOT be constructed in standard programming.
-
Method Summary
Modifier and Type Method Description static StringtoString(Object array)Outputs an array as a String, treating {@code null}as an empty array.static StringtoString(Object array, String stringIfNull)Outputs an array as a String handling {@code null}s.static inthashCode(Object array)Get a hash code for an array handling multi-dimensional arrays correctly. static booleanisEquals(Object array1, Object array2)Compares two arrays, using equals(), handling multi-dimensional arrayscorrectly. static Map<Object, Object>toMap(Array<Object> array)Converts the given array into a java.util.Map. static <T> Array<T>toArray(Array<T> items)Create a type-safe generic array. static <T> Array<T>clone(Array<T> array)Shallow clones an array returning a typecast result and handling {@code null}.static Array<long>clone(Array<long> array)Clones an array returning a typecast result and handling {@code null}.static Array<int>clone(Array<int> array)Clones an array returning a typecast result and handling {@code null}.static Array<short>clone(Array<short> array)Clones an array returning a typecast result and handling {@code null}.static Array<char>clone(Array<char> array)Clones an array returning a typecast result and handling {@code null}.static Array<byte>clone(Array<byte> array)Clones an array returning a typecast result and handling {@code null}.static Array<double>clone(Array<double> array)Clones an array returning a typecast result and handling {@code null}.static Array<float>clone(Array<float> array)Clones an array returning a typecast result and handling {@code null}.static Array<boolean>clone(Array<boolean> array)Clones an array returning a typecast result and handling {@code null}.static Array<Object>nullToEmpty(Array<Object> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<String>nullToEmpty(Array<String> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<long>nullToEmpty(Array<long> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<int>nullToEmpty(Array<int> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<short>nullToEmpty(Array<short> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<char>nullToEmpty(Array<char> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<byte>nullToEmpty(Array<byte> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<double>nullToEmpty(Array<double> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<float>nullToEmpty(Array<float> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<boolean>nullToEmpty(Array<boolean> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<Long>nullToEmpty(Array<Long> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<Integer>nullToEmpty(Array<Integer> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<Short>nullToEmpty(Array<Short> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<Character>nullToEmpty(Array<Character> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<Byte>nullToEmpty(Array<Byte> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<Double>nullToEmpty(Array<Double> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<Float>nullToEmpty(Array<Float> array)Defensive programming technique to change a {@code null}reference to an empty one.static Array<Boolean>nullToEmpty(Array<Boolean> array)Defensive programming technique to change a {@code null}reference to an empty one.static <T> Array<T>subarray(Array<T> array, int startIndexInclusive, int endIndexExclusive)Produces a new array containing the elements betweenthe start and end indices. static Array<long>subarray(Array<long> array, int startIndexInclusive, int endIndexExclusive)Produces a new {@code long}array containing the elementsbetween the start and end indices.static Array<int>subarray(Array<int> array, int startIndexInclusive, int endIndexExclusive)Produces a new {@code int}array containing the elementsbetween the start and end indices.static Array<short>subarray(Array<short> array, int startIndexInclusive, int endIndexExclusive)Produces a new {@code short}array containing the elementsbetween the start and end indices.static Array<char>subarray(Array<char> array, int startIndexInclusive, int endIndexExclusive)Produces a new {@code char}array containing the elementsbetween the start and end indices.static Array<byte>subarray(Array<byte> array, int startIndexInclusive, int endIndexExclusive)Produces a new {@code byte}array containing the elementsbetween the start and end indices.static Array<double>subarray(Array<double> array, int startIndexInclusive, int endIndexExclusive)Produces a new {@code double}array containing the elementsbetween the start and end indices.static Array<float>subarray(Array<float> array, int startIndexInclusive, int endIndexExclusive)Produces a new {@code float}array containing the elementsbetween the start and end indices.static Array<boolean>subarray(Array<boolean> array, int startIndexInclusive, int endIndexExclusive)Produces a new {@code boolean}array containing the elementsbetween the start and end indices.static booleanisSameLength(Array<Object> array1, Array<Object> array2)Checks whether two arrays are the same length, treating {@code null}arrays as length{@code 0}.static booleanisSameLength(Array<long> array1, Array<long> array2)Checks whether two arrays are the same length, treating {@code null}arrays as length{@code 0}.static booleanisSameLength(Array<int> array1, Array<int> array2)Checks whether two arrays are the same length, treating {@code null}arrays as length{@code 0}.static booleanisSameLength(Array<short> array1, Array<short> array2)Checks whether two arrays are the same length, treating {@code null}arrays as length{@code 0}.static booleanisSameLength(Array<char> array1, Array<char> array2)Checks whether two arrays are the same length, treating {@code null}arrays as length{@code 0}.static booleanisSameLength(Array<byte> array1, Array<byte> array2)Checks whether two arrays are the same length, treating {@code null}arrays as length{@code 0}.static booleanisSameLength(Array<double> array1, Array<double> array2)Checks whether two arrays are the same length, treating {@code null}arrays as length{@code 0}.static booleanisSameLength(Array<float> array1, Array<float> array2)Checks whether two arrays are the same length, treating {@code null}arrays as length{@code 0}.static booleanisSameLength(Array<boolean> array1, Array<boolean> array2)Checks whether two arrays are the same length, treating {@code null}arrays as length{@code 0}.static intgetLength(Object array)Returns the length of the specified array. static booleanisSameType(Object array1, Object array2)Checks whether two arrays are the same type taking into accountmulti-dimensional arrays. static voidreverse(Array<Object> array)Reverses the order of the given array. static voidreverse(Array<long> array)Reverses the order of the given array. static voidreverse(Array<int> array)Reverses the order of the given array. static voidreverse(Array<short> array)Reverses the order of the given array. static voidreverse(Array<char> array)Reverses the order of the given array. static voidreverse(Array<byte> array)Reverses the order of the given array. static voidreverse(Array<double> array)Reverses the order of the given array. static voidreverse(Array<float> array)Reverses the order of the given array. static voidreverse(Array<boolean> array)Reverses the order of the given array. static intindexOf(Array<Object> array, Object objectToFind)Finds the index of the given object in the array. static intindexOf(Array<Object> array, Object objectToFind, int startIndex)Finds the index of the given object in the array starting at the given index. static intlastIndexOf(Array<Object> array, Object objectToFind)Finds the last index of the given object within the array. static intlastIndexOf(Array<Object> array, Object objectToFind, int startIndex)Finds the last index of the given object in the array starting at the given index. static booleancontains(Array<Object> array, Object objectToFind)Checks if the object is in the given array. static intindexOf(Array<long> array, long valueToFind)Finds the index of the given value in the array. static intindexOf(Array<long> array, long valueToFind, int startIndex)Finds the index of the given value in the array starting at the given index. static intlastIndexOf(Array<long> array, long valueToFind)Finds the last index of the given value within the array. static intlastIndexOf(Array<long> array, long valueToFind, int startIndex)Finds the last index of the given value in the array starting at the given index. static booleancontains(Array<long> array, long valueToFind)Checks if the value is in the given array. static intindexOf(Array<int> array, int valueToFind)Finds the index of the given value in the array. static intindexOf(Array<int> array, int valueToFind, int startIndex)Finds the index of the given value in the array starting at the given index. static intlastIndexOf(Array<int> array, int valueToFind)Finds the last index of the given value within the array. static intlastIndexOf(Array<int> array, int valueToFind, int startIndex)Finds the last index of the given value in the array starting at the given index. static booleancontains(Array<int> array, int valueToFind)Checks if the value is in the given array. static intindexOf(Array<short> array, short valueToFind)Finds the index of the given value in the array. static intindexOf(Array<short> array, short valueToFind, int startIndex)Finds the index of the given value in the array starting at the given index. static intlastIndexOf(Array<short> array, short valueToFind)Finds the last index of the given value within the array. static intlastIndexOf(Array<short> array, short valueToFind, int startIndex)Finds the last index of the given value in the array starting at the given index. static booleancontains(Array<short> array, short valueToFind)Checks if the value is in the given array. static intindexOf(Array<char> array, char valueToFind)Finds the index of the given value in the array. static intindexOf(Array<char> array, char valueToFind, int startIndex)Finds the index of the given value in the array starting at the given index. static intlastIndexOf(Array<char> array, char valueToFind)Finds the last index of the given value within the array. static intlastIndexOf(Array<char> array, char valueToFind, int startIndex)Finds the last index of the given value in the array starting at the given index. static booleancontains(Array<char> array, char valueToFind)Checks if the value is in the given array. static intindexOf(Array<byte> array, byte valueToFind)Finds the index of the given value in the array. static intindexOf(Array<byte> array, byte valueToFind, int startIndex)Finds the index of the given value in the array starting at the given index. static intlastIndexOf(Array<byte> array, byte valueToFind)Finds the last index of the given value within the array. static intlastIndexOf(Array<byte> array, byte valueToFind, int startIndex)Finds the last index of the given value in the array starting at the given index. static booleancontains(Array<byte> array, byte valueToFind)Checks if the value is in the given array. static intindexOf(Array<double> array, double valueToFind)Finds the index of the given value in the array. static intindexOf(Array<double> array, double valueToFind, double tolerance)Finds the index of the given value within a given tolerance in the array.This method will return the index of the first value which falls between the regiondefined by valueToFind - tolerance and valueToFind + tolerance. static intindexOf(Array<double> array, double valueToFind, int startIndex)Finds the index of the given value in the array starting at the given index. static intindexOf(Array<double> array, double valueToFind, int startIndex, double tolerance)Finds the index of the given value in the array starting at the given index.This method will return the index of the first value which falls between the regiondefined by valueToFind - tolerance and valueToFind + tolerance. static intlastIndexOf(Array<double> array, double valueToFind)Finds the last index of the given value within the array. static intlastIndexOf(Array<double> array, double valueToFind, double tolerance)Finds the last index of the given value within a given tolerance in the array.This method will return the index of the last value which falls between the regiondefined by valueToFind - tolerance and valueToFind + tolerance. static intlastIndexOf(Array<double> array, double valueToFind, int startIndex)Finds the last index of the given value in the array starting at the given index. static intlastIndexOf(Array<double> array, double valueToFind, int startIndex, double tolerance)Finds the last index of the given value in the array starting at the given index.This method will return the index of the last value which falls between the regiondefined by valueToFind - tolerance and valueToFind + tolerance. static booleancontains(Array<double> array, double valueToFind)Checks if the value is in the given array. static booleancontains(Array<double> array, double valueToFind, double tolerance)Checks if a value falling within the given tolerance is in thegiven array. static intindexOf(Array<float> array, float valueToFind)Finds the index of the given value in the array. static intindexOf(Array<float> array, float valueToFind, int startIndex)Finds the index of the given value in the array starting at the given index. static intlastIndexOf(Array<float> array, float valueToFind)Finds the last index of the given value within the array. static intlastIndexOf(Array<float> array, float valueToFind, int startIndex)Finds the last index of the given value in the array starting at the given index. static booleancontains(Array<float> array, float valueToFind)Checks if the value is in the given array. static intindexOf(Array<boolean> array, boolean valueToFind)Finds the index of the given value in the array. static intindexOf(Array<boolean> array, boolean valueToFind, int startIndex)Finds the index of the given value in the array starting at the given index. static intlastIndexOf(Array<boolean> array, boolean valueToFind)Finds the last index of the given value within the array. static intlastIndexOf(Array<boolean> array, boolean valueToFind, int startIndex)Finds the last index of the given value in the array starting at the given index. static booleancontains(Array<boolean> array, boolean valueToFind)Checks if the value is in the given array. static Array<char>toPrimitive(Array<Character> array)Converts an array of object Characters to primitives. static Array<char>toPrimitive(Array<Character> array, char valueForNull)Converts an array of object Character to primitives handling {@code null}.static Array<Character>toObject(Array<char> array)Converts an array of primitive chars to objects. static Array<long>toPrimitive(Array<Long> array)Converts an array of object Longs to primitives. static Array<long>toPrimitive(Array<Long> array, long valueForNull)Converts an array of object Long to primitives handling {@code null}.static Array<Long>toObject(Array<long> array)Converts an array of primitive longs to objects. static Array<int>toPrimitive(Array<Integer> array)Converts an array of object Integers to primitives. static Array<int>toPrimitive(Array<Integer> array, int valueForNull)Converts an array of object Integer to primitives handling {@code null}.static Array<Integer>toObject(Array<int> array)Converts an array of primitive ints to objects. static Array<short>toPrimitive(Array<Short> array)Converts an array of object Shorts to primitives. static Array<short>toPrimitive(Array<Short> array, short valueForNull)Converts an array of object Short to primitives handling {@code null}.static Array<Short>toObject(Array<short> array)Converts an array of primitive shorts to objects. static Array<byte>toPrimitive(Array<Byte> array)Converts an array of object Bytes to primitives. static Array<byte>toPrimitive(Array<Byte> array, byte valueForNull)Converts an array of object Bytes to primitives handling {@code null}.static Array<Byte>toObject(Array<byte> array)Converts an array of primitive bytes to objects. static Array<double>toPrimitive(Array<Double> array)Converts an array of object Doubles to primitives. static Array<double>toPrimitive(Array<Double> array, double valueForNull)Converts an array of object Doubles to primitives handling {@code null}.static Array<Double>toObject(Array<double> array)Converts an array of primitive doubles to objects. static Array<float>toPrimitive(Array<Float> array)Converts an array of object Floats to primitives. static Array<float>toPrimitive(Array<Float> array, float valueForNull)Converts an array of object Floats to primitives handling {@code null}.static Array<Float>toObject(Array<float> array)Converts an array of primitive floats to objects. static Array<boolean>toPrimitive(Array<Boolean> array)Converts an array of object Booleans to primitives. static Array<boolean>toPrimitive(Array<Boolean> array, boolean valueForNull)Converts an array of object Booleans to primitives handling {@code null}.static Array<Boolean>toObject(Array<boolean> array)Converts an array of primitive booleans to objects. static booleanisEmpty(Array<Object> array)Checks if an array of Objects is empty or {@code null}.static booleanisEmpty(Array<long> array)Checks if an array of primitive longs is empty or {@code null}.static booleanisEmpty(Array<int> array)Checks if an array of primitive ints is empty or {@code null}.static booleanisEmpty(Array<short> array)Checks if an array of primitive shorts is empty or {@code null}.static booleanisEmpty(Array<char> array)Checks if an array of primitive chars is empty or {@code null}.static booleanisEmpty(Array<byte> array)Checks if an array of primitive bytes is empty or {@code null}.static booleanisEmpty(Array<double> array)Checks if an array of primitive doubles is empty or {@code null}.static booleanisEmpty(Array<float> array)Checks if an array of primitive floats is empty or {@code null}.static booleanisEmpty(Array<boolean> array)Checks if an array of primitive booleans is empty or {@code null}.static <T> booleanisNotEmpty(Array<T> array)Checks if an array of Objects is not empty or not {@code null}.static booleanisNotEmpty(Array<long> array)Checks if an array of primitive longs is not empty or not {@code null}.static booleanisNotEmpty(Array<int> array)Checks if an array of primitive ints is not empty or not {@code null}.static booleanisNotEmpty(Array<short> array)Checks if an array of primitive shorts is not empty or not {@code null}.static booleanisNotEmpty(Array<char> array)Checks if an array of primitive chars is not empty or not {@code null}.static booleanisNotEmpty(Array<byte> array)Checks if an array of primitive bytes is not empty or not {@code null}.static booleanisNotEmpty(Array<double> array)Checks if an array of primitive doubles is not empty or not {@code null}.static booleanisNotEmpty(Array<float> array)Checks if an array of primitive floats is not empty or not {@code null}.static booleanisNotEmpty(Array<boolean> array)Checks if an array of primitive booleans is not empty or not {@code null}.static <T> Array<T>addAll(Array<T> array1, Array<T> array2)Adds all the elements of the given arrays into a new array. static Array<boolean>addAll(Array<boolean> array1, Array<boolean> array2)Adds all the elements of the given arrays into a new array. static Array<char>addAll(Array<char> array1, Array<char> array2)Adds all the elements of the given arrays into a new array. static Array<byte>addAll(Array<byte> array1, Array<byte> array2)Adds all the elements of the given arrays into a new array. static Array<short>addAll(Array<short> array1, Array<short> array2)Adds all the elements of the given arrays into a new array. static Array<int>addAll(Array<int> array1, Array<int> array2)Adds all the elements of the given arrays into a new array. static Array<long>addAll(Array<long> array1, Array<long> array2)Adds all the elements of the given arrays into a new array. static Array<float>addAll(Array<float> array1, Array<float> array2)Adds all the elements of the given arrays into a new array. static Array<double>addAll(Array<double> array1, Array<double> array2)Adds all the elements of the given arrays into a new array. static <T> Array<T>add(Array<T> array, T element)Copies the given array and adds the given element at the end of the new array. static Array<boolean>add(Array<boolean> array, boolean element)Copies the given array and adds the given element at the end of the new array. static Array<byte>add(Array<byte> array, byte element)Copies the given array and adds the given element at the end of the new array. static Array<char>add(Array<char> array, char element)Copies the given array and adds the given element at the end of the new array. static Array<double>add(Array<double> array, double element)Copies the given array and adds the given element at the end of the new array. static Array<float>add(Array<float> array, float element)Copies the given array and adds the given element at the end of the new array. static Array<int>add(Array<int> array, int element)Copies the given array and adds the given element at the end of the new array. static Array<long>add(Array<long> array, long element)Copies the given array and adds the given element at the end of the new array. static Array<short>add(Array<short> array, short element)Copies the given array and adds the given element at the end of the new array. static <T> Array<T>add(Array<T> array, int index, T element)Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices). static Array<boolean>add(Array<boolean> array, int index, boolean element)Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices). static Array<char>add(Array<char> array, int index, char element)Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices). static Array<byte>add(Array<byte> array, int index, byte element)Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices). static Array<short>add(Array<short> array, int index, short element)Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices). static Array<int>add(Array<int> array, int index, int element)Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices). static Array<long>add(Array<long> array, int index, long element)Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices). static Array<float>add(Array<float> array, int index, float element)Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices). static Array<double>add(Array<double> array, int index, double element)Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices). static <T> Array<T>remove(Array<T> array, int index)Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices). static <T> Array<T>removeElement(Array<T> array, Object element)Removes the first occurrence of the specified element from thespecified array. static Array<boolean>remove(Array<boolean> array, int index)Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices). static Array<boolean>removeElement(Array<boolean> array, boolean element)Removes the first occurrence of the specified element from thespecified array. static Array<byte>remove(Array<byte> array, int index)Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices). static Array<byte>removeElement(Array<byte> array, byte element)Removes the first occurrence of the specified element from thespecified array. static Array<char>remove(Array<char> array, int index)Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices). static Array<char>removeElement(Array<char> array, char element)Removes the first occurrence of the specified element from thespecified array. static Array<double>remove(Array<double> array, int index)Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices). static Array<double>removeElement(Array<double> array, double element)Removes the first occurrence of the specified element from thespecified array. static Array<float>remove(Array<float> array, int index)Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices). static Array<float>removeElement(Array<float> array, float element)Removes the first occurrence of the specified element from thespecified array. static Array<int>remove(Array<int> array, int index)Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices). static Array<int>removeElement(Array<int> array, int element)Removes the first occurrence of the specified element from thespecified array. static Array<long>remove(Array<long> array, int index)Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices). static Array<long>removeElement(Array<long> array, long element)Removes the first occurrence of the specified element from thespecified array. static Array<short>remove(Array<short> array, int index)Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices). static Array<short>removeElement(Array<short> array, short element)Removes the first occurrence of the specified element from thespecified array. static <T> Array<T>removeAll(Array<T> array, Array<int> indices)Removes the elements at the specified positions from the specified array.All remaining elements are shifted to the left. static <T> Array<T>removeElements(Array<T> array, Array<T> values)Removes occurrences of specified elements, in specified quantities,from the specified array. static Array<byte>removeAll(Array<byte> array, Array<int> indices)Removes the elements at the specified positions from the specified array.All remaining elements are shifted to the left. static Array<byte>removeElements(Array<byte> array, Array<byte> values)Removes occurrences of specified elements, in specified quantities,from the specified array. static Array<short>removeAll(Array<short> array, Array<int> indices)Removes the elements at the specified positions from the specified array.All remaining elements are shifted to the left. static Array<short>removeElements(Array<short> array, Array<short> values)Removes occurrences of specified elements, in specified quantities,from the specified array. static Array<int>removeAll(Array<int> array, Array<int> indices)Removes the elements at the specified positions from the specified array.All remaining elements are shifted to the left. static Array<int>removeElements(Array<int> array, Array<int> values)Removes occurrences of specified elements, in specified quantities,from the specified array. static Array<char>removeAll(Array<char> array, Array<int> indices)Removes the elements at the specified positions from the specified array.All remaining elements are shifted to the left. static Array<char>removeElements(Array<char> array, Array<char> values)Removes occurrences of specified elements, in specified quantities,from the specified array. static Array<long>removeAll(Array<long> array, Array<int> indices)Removes the elements at the specified positions from the specified array.All remaining elements are shifted to the left. static Array<long>removeElements(Array<long> array, Array<long> values)Removes occurrences of specified elements, in specified quantities,from the specified array. static Array<float>removeAll(Array<float> array, Array<int> indices)Removes the elements at the specified positions from the specified array.All remaining elements are shifted to the left. static Array<float>removeElements(Array<float> array, Array<float> values)Removes occurrences of specified elements, in specified quantities,from the specified array. static Array<double>removeAll(Array<double> array, Array<int> indices)Removes the elements at the specified positions from the specified array.All remaining elements are shifted to the left. static Array<double>removeElements(Array<double> array, Array<double> values)Removes occurrences of specified elements, in specified quantities,from the specified array. static Array<boolean>removeAll(Array<boolean> array, Array<int> indices)Removes the elements at the specified positions from the specified array.All remaining elements are shifted to the left. static Array<boolean>removeElements(Array<boolean> array, Array<boolean> values)Removes occurrences of specified elements, in specified quantities,from the specified array. -
-
Method Detail
-
toString
static String toString(Object array)
Outputs an array as a String, treating
{@code null}as an empty array.Multi-dimensional arrays are handled correctly, includingmulti-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{@code null}
-
toString
static String toString(Object array, String stringIfNull)
Outputs an array as a String handling
{@code null}s.Multi-dimensional arrays are handled correctly, includingmulti-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{@code null}stringIfNull- the String to return if the array is{@code null}
-
hashCode
static int hashCode(Object array)
Get a hash code for an array handling multi-dimensional arrays correctly.
Multi-dimensional primitive arrays are also handled correctly by this method.
- Parameters:
array- the array to get a hash code for,{@code null}returns zero
-
isEquals
static boolean isEquals(Object array1, Object array2)
Compares two arrays, using equals(), handling multi-dimensional arrayscorrectly.
Multi-dimensional primitive arrays are also handled correctly by this method.
- Parameters:
array1- the left hand array to compare, may be{@code null}array2- the right hand array to compare, may be{@code null}
-
toMap
static Map<Object, Object> toMap(Array<Object> array)
Converts the given array into a java.util.Map. Each element of the arraymust be either a java.util.Map.Entry or an Array, containing at least twoelements, where the first element is used as key and the second asvalue.
This method can be used to initialize:
// Create a Map mapping colors. Map colorMap = MapUtils.toMap(new String[][] {{ {"RED", "#FF0000"}, {"GREEN", "#00FF00"}, {"BLUE", "#0000FF"}});This method returns
{@code null}for a{@code null}input array.- Parameters:
array- an array whose elements are either a java.util.Map.Entry oran Array containing at least two elements, may be{@code null}
-
toArray
static <T> Array<T> toArray(Array<T> items)
Create 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 typesthat have to be combined into an array.
Note, this method makes only sense to provide arguments of the same type so that thecompiler can deduce the type of the array itself. While it is possible to select thetype 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)}.- Parameters:
items- the varargs array items, null allowed
-
clone
static <T> Array<T> clone(Array<T> array)
Shallow clones an array returning a typecast result and handling
{@code null}.The objects in the array are not cloned, thus there is no specialhandling for multi-dimensional arrays.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- the array to shallow clone, may be{@code null}
-
clone
static Array<long> clone(Array<long> array)
Clones an array returning a typecast result and handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- the array to clone, may be{@code null}
-
clone
static Array<int> clone(Array<int> array)
Clones an array returning a typecast result and handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- the array to clone, may be{@code null}
-
clone
static Array<short> clone(Array<short> array)
Clones an array returning a typecast result and handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- the array to clone, may be{@code null}
-
clone
static Array<char> clone(Array<char> array)
Clones an array returning a typecast result and handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- the array to clone, may be{@code null}
-
clone
static Array<byte> clone(Array<byte> array)
Clones an array returning a typecast result and handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- the array to clone, may be{@code null}
-
clone
static Array<double> clone(Array<double> array)
Clones an array returning a typecast result and handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- the array to clone, may be{@code null}
-
clone
static Array<float> clone(Array<float> array)
Clones an array returning a typecast result and handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- the array to clone, may be{@code null}
-
clone
static Array<boolean> clone(Array<boolean> array)
Clones an array returning a typecast result and handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- the array to clone, may be{@code null}
-
nullToEmpty
static Array<Object> nullToEmpty(Array<Object> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<String> nullToEmpty(Array<String> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<long> nullToEmpty(Array<long> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<int> nullToEmpty(Array<int> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<short> nullToEmpty(Array<short> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<char> nullToEmpty(Array<char> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<byte> nullToEmpty(Array<byte> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<double> nullToEmpty(Array<double> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<float> nullToEmpty(Array<float> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<boolean> nullToEmpty(Array<boolean> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<Long> nullToEmpty(Array<Long> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<Integer> nullToEmpty(Array<Integer> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<Short> nullToEmpty(Array<Short> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<Character> nullToEmpty(Array<Character> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<Byte> nullToEmpty(Array<Byte> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<Double> nullToEmpty(Array<Double> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<Float> nullToEmpty(Array<Float> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
nullToEmpty
static Array<Boolean> nullToEmpty(Array<Boolean> array)
Defensive programming technique to change a
{@code null}reference to an empty one.This method returns an empty array for a
{@code null}input array.As a memory optimizing technique an empty array passed in will be overridden withthe empty
{@code public static}references in this class.- Parameters:
array- the array to check for{@code null}or empty
-
subarray
static <T> Array<T> subarray(Array<T> array, int startIndexInclusive, int endIndexExclusive)
Produces a new array containing the elements betweenthe 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 asthat of the input array. Thus, if the input is an array of type
{@code Date}, the following usage is envisaged:Date[] someDates = (Date[])ArrayUtils.subarray(allDates, 2, 5);- Parameters:
array- the arraystartIndexInclusive- the starting index.endIndexExclusive- elements up to endIndex-1 are present in thereturned subarray.
-
subarray
static Array<long> subarray(Array<long> array, int startIndexInclusive, int endIndexExclusive)
Produces a new
{@code long}array containing the elementsbetween the start and end indices.The start index is inclusive, the end index exclusive.Null array input produces null output.
- Parameters:
array- the arraystartIndexInclusive- the starting index.endIndexExclusive- elements up to endIndex-1 are present in thereturned subarray.
-
subarray
static Array<int> subarray(Array<int> array, int startIndexInclusive, int endIndexExclusive)
Produces a new
{@code int}array containing the elementsbetween the start and end indices.The start index is inclusive, the end index exclusive.Null array input produces null output.
- Parameters:
array- the arraystartIndexInclusive- the starting index.endIndexExclusive- elements up to endIndex-1 are present in thereturned subarray.
-
subarray
static Array<short> subarray(Array<short> array, int startIndexInclusive, int endIndexExclusive)
Produces a new
{@code short}array containing the elementsbetween the start and end indices.The start index is inclusive, the end index exclusive.Null array input produces null output.
- Parameters:
array- the arraystartIndexInclusive- the starting index.endIndexExclusive- elements up to endIndex-1 are present in thereturned subarray.
-
subarray
static Array<char> subarray(Array<char> array, int startIndexInclusive, int endIndexExclusive)
Produces a new
{@code char}array containing the elementsbetween the start and end indices.The start index is inclusive, the end index exclusive.Null array input produces null output.
- Parameters:
array- the arraystartIndexInclusive- the starting index.endIndexExclusive- elements up to endIndex-1 are present in thereturned subarray.
-
subarray
static Array<byte> subarray(Array<byte> array, int startIndexInclusive, int endIndexExclusive)
Produces a new
{@code byte}array containing the elementsbetween the start and end indices.The start index is inclusive, the end index exclusive.Null array input produces null output.
- Parameters:
array- the arraystartIndexInclusive- the starting index.endIndexExclusive- elements up to endIndex-1 are present in thereturned subarray.
-
subarray
static Array<double> subarray(Array<double> array, int startIndexInclusive, int endIndexExclusive)
Produces a new
{@code double}array containing the elementsbetween the start and end indices.The start index is inclusive, the end index exclusive.Null array input produces null output.
- Parameters:
array- the arraystartIndexInclusive- the starting index.endIndexExclusive- elements up to endIndex-1 are present in thereturned subarray.
-
subarray
static Array<float> subarray(Array<float> array, int startIndexInclusive, int endIndexExclusive)
Produces a new
{@code float}array containing the elementsbetween the start and end indices.The start index is inclusive, the end index exclusive.Null array input produces null output.
- Parameters:
array- the arraystartIndexInclusive- the starting index.endIndexExclusive- elements up to endIndex-1 are present in thereturned subarray.
-
subarray
static Array<boolean> subarray(Array<boolean> array, int startIndexInclusive, int endIndexExclusive)
Produces a new
{@code boolean}array containing the elementsbetween the start and end indices.The start index is inclusive, the end index exclusive.Null array input produces null output.
- Parameters:
array- the arraystartIndexInclusive- the starting index.endIndexExclusive- elements up to endIndex-1 are present in thereturned subarray.
-
isSameLength
static boolean isSameLength(Array<Object> array1, Array<Object> array2)
Checks whether two arrays are the same length, treating
{@code null}arrays as length{@code 0}.Any multi-dimensional aspects of the arrays are ignored.
- Parameters:
array1- the first array, may be{@code null}array2- the second array, may be{@code null}
-
isSameLength
static boolean isSameLength(Array<long> array1, Array<long> array2)
Checks whether two arrays are the same length, treating
{@code null}arrays as length{@code 0}.- Parameters:
array1- the first array, may be{@code null}array2- the second array, may be{@code null}
-
isSameLength
static boolean isSameLength(Array<int> array1, Array<int> array2)
Checks whether two arrays are the same length, treating
{@code null}arrays as length{@code 0}.- Parameters:
array1- the first array, may be{@code null}array2- the second array, may be{@code null}
-
isSameLength
static boolean isSameLength(Array<short> array1, Array<short> array2)
Checks whether two arrays are the same length, treating
{@code null}arrays as length{@code 0}.- Parameters:
array1- the first array, may be{@code null}array2- the second array, may be{@code null}
-
isSameLength
static boolean isSameLength(Array<char> array1, Array<char> array2)
Checks whether two arrays are the same length, treating
{@code null}arrays as length{@code 0}.- Parameters:
array1- the first array, may be{@code null}array2- the second array, may be{@code null}
-
isSameLength
static boolean isSameLength(Array<byte> array1, Array<byte> array2)
Checks whether two arrays are the same length, treating
{@code null}arrays as length{@code 0}.- Parameters:
array1- the first array, may be{@code null}array2- the second array, may be{@code null}
-
isSameLength
static boolean isSameLength(Array<double> array1, Array<double> array2)
Checks whether two arrays are the same length, treating
{@code null}arrays as length{@code 0}.- Parameters:
array1- the first array, may be{@code null}array2- the second array, may be{@code null}
-
isSameLength
static boolean isSameLength(Array<float> array1, Array<float> array2)
Checks whether two arrays are the same length, treating
{@code null}arrays as length{@code 0}.- Parameters:
array1- the first array, may be{@code null}array2- the second array, may be{@code null}
-
isSameLength
static boolean isSameLength(Array<boolean> array1, Array<boolean> array2)
Checks whether two arrays are the same length, treating
{@code null}arrays as length{@code 0}.- Parameters:
array1- the first array, may be{@code null}array2- the second array, may be{@code null}
-
getLength
static int getLength(Object array)
Returns the length of the specified array.This method can deal with
{@code Object}arrays and with primitive arrays.If the input array is
{@code null},{@code 0}is returned.ArrayUtils.getLength(null) = 0 ArrayUtils.getLength([]) = 0 ArrayUtils.getLength([null]) = 1 ArrayUtils.getLength([true, false]) = 2 ArrayUtils.getLength([1, 2, 3]) = 3 ArrayUtils.getLength(["a", "b", "c"]) = 3- Parameters:
array- the array to retrieve the length from, may be null
-
isSameType
static boolean isSameType(Object array1, Object array2)
Checks whether two arrays are the same type taking into accountmulti-dimensional arrays.
- Parameters:
array1- the first array, must not be{@code null}array2- the second array, must not be{@code null}
-
reverse
static void reverse(Array<Object> array)
Reverses the order of the given array.
There is no special handling for multi-dimensional arrays.
This method does nothing for a
{@code null}input array.- Parameters:
array- the array to reverse, may be{@code null}
-
reverse
static void reverse(Array<long> array)
Reverses the order of the given array.
This method does nothing for a
{@code null}input array.- Parameters:
array- the array to reverse, may be{@code null}
-
reverse
static void reverse(Array<int> array)
Reverses the order of the given array.
This method does nothing for a
{@code null}input array.- Parameters:
array- the array to reverse, may be{@code null}
-
reverse
static void reverse(Array<short> array)
Reverses the order of the given array.
This method does nothing for a
{@code null}input array.- Parameters:
array- the array to reverse, may be{@code null}
-
reverse
static void reverse(Array<char> array)
Reverses the order of the given array.
This method does nothing for a
{@code null}input array.- Parameters:
array- the array to reverse, may be{@code null}
-
reverse
static void reverse(Array<byte> array)
Reverses the order of the given array.
This method does nothing for a
{@code null}input array.- Parameters:
array- the array to reverse, may be{@code null}
-
reverse
static void reverse(Array<double> array)
Reverses the order of the given array.
This method does nothing for a
{@code null}input array.- Parameters:
array- the array to reverse, may be{@code null}
-
reverse
static void reverse(Array<float> array)
Reverses the order of the given array.
This method does nothing for a
{@code null}input array.- Parameters:
array- the array to reverse, may be{@code null}
-
reverse
static void reverse(Array<boolean> array)
Reverses the order of the given array.
This method does nothing for a
{@code null}input array.- Parameters:
array- the array to reverse, may be{@code null}
-
indexOf
static int indexOf(Array<Object> array, Object objectToFind)
Finds the index of the given object in the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to search through for the object, may be{@code null}objectToFind- the object to find, may be{@code null}
-
indexOf
static int indexOf(Array<Object> array, Object objectToFind, int startIndex)
Finds the index of the given object in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex is treated as zero. A startIndex larger than the arraylength will return INDEX_NOT_FOUND (
{@code -1}).- Parameters:
array- the array to search through for the object, may be{@code null}objectToFind- the object to find, may be{@code null}startIndex- the index to start searching at
-
lastIndexOf
static int lastIndexOf(Array<Object> array, Object objectToFind)
Finds the last index of the given object within the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to travers backwords looking for the object, may be{@code null}objectToFind- the object to find, may be{@code null}
-
lastIndexOf
static int lastIndexOf(Array<Object> array, Object objectToFind, int startIndex)
Finds the last index of the given object in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex will return INDEX_NOT_FOUND (
{@code -1}). A startIndex larger thanthe array length will search from the end of the array.- Parameters:
array- the array to traverse for looking for the object, may be{@code null}objectToFind- the object to find, may be{@code null}startIndex- the start index to travers backwards from
-
contains
static boolean contains(Array<Object> array, Object objectToFind)
Checks if the object is in the given array.
The method returns
{@code false}if a{@code null}array is passed in.- Parameters:
array- the array to search throughobjectToFind- the object to find
-
indexOf
static int indexOf(Array<long> array, long valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to find
-
indexOf
static int indexOf(Array<long> array, long valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex is treated as zero. A startIndex larger than the arraylength will return INDEX_NOT_FOUND (
{@code -1}).- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to findstartIndex- the index to start searching at
-
lastIndexOf
static int lastIndexOf(Array<long> array, long valueToFind)
Finds the last index of the given value within the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to travers backwords looking for the object, may be{@code null}valueToFind- the object to find
-
lastIndexOf
static int lastIndexOf(Array<long> array, long valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex will return INDEX_NOT_FOUND (
{@code -1}). A startIndex larger than thearray length will search from the end of the array.- Parameters:
array- the array to traverse for looking for the object, may be{@code null}valueToFind- the value to findstartIndex- the start index to travers backwards from
-
contains
static boolean contains(Array<long> array, long valueToFind)
Checks if the value is in the given array.
The method returns
{@code false}if a{@code null}array is passed in.- Parameters:
array- the array to search throughvalueToFind- the value to find
-
indexOf
static int indexOf(Array<int> array, int valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to find
-
indexOf
static int indexOf(Array<int> array, int valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex is treated as zero. A startIndex larger than the arraylength will return INDEX_NOT_FOUND (
{@code -1}).- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to findstartIndex- the index to start searching at
-
lastIndexOf
static int lastIndexOf(Array<int> array, int valueToFind)
Finds the last index of the given value within the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to travers backwords looking for the object, may be{@code null}valueToFind- the object to find
-
lastIndexOf
static int lastIndexOf(Array<int> array, int valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex will return INDEX_NOT_FOUND (
{@code -1}). A startIndex larger than thearray length will search from the end of the array.- Parameters:
array- the array to traverse for looking for the object, may be{@code null}valueToFind- the value to findstartIndex- the start index to travers backwards from
-
contains
static boolean contains(Array<int> array, int valueToFind)
Checks if the value is in the given array.
The method returns
{@code false}if a{@code null}array is passed in.- Parameters:
array- the array to search throughvalueToFind- the value to find
-
indexOf
static int indexOf(Array<short> array, short valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to find
-
indexOf
static int indexOf(Array<short> array, short valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex is treated as zero. A startIndex larger than the arraylength will return INDEX_NOT_FOUND (
{@code -1}).- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to findstartIndex- the index to start searching at
-
lastIndexOf
static int lastIndexOf(Array<short> array, short valueToFind)
Finds the last index of the given value within the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to travers backwords looking for the object, may be{@code null}valueToFind- the object to find
-
lastIndexOf
static int lastIndexOf(Array<short> array, short valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex will return INDEX_NOT_FOUND (
{@code -1}). A startIndex larger than thearray length will search from the end of the array.- Parameters:
array- the array to traverse for looking for the object, may be{@code null}valueToFind- the value to findstartIndex- the start index to travers backwards from
-
contains
static boolean contains(Array<short> array, short valueToFind)
Checks if the value is in the given array.
The method returns
{@code false}if a{@code null}array is passed in.- Parameters:
array- the array to search throughvalueToFind- the value to find
-
indexOf
static int indexOf(Array<char> array, char valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to find
-
indexOf
static int indexOf(Array<char> array, char valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex is treated as zero. A startIndex larger than the arraylength will return INDEX_NOT_FOUND (
{@code -1}).- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to findstartIndex- the index to start searching at
-
lastIndexOf
static int lastIndexOf(Array<char> array, char valueToFind)
Finds the last index of the given value within the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to travers backwords looking for the object, may be{@code null}valueToFind- the object to find
-
lastIndexOf
static int lastIndexOf(Array<char> array, char valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex will return INDEX_NOT_FOUND (
{@code -1}). A startIndex larger than thearray length will search from the end of the array.- Parameters:
array- the array to traverse for looking for the object, may be{@code null}valueToFind- the value to findstartIndex- the start index to travers backwards from
-
contains
static boolean contains(Array<char> array, char valueToFind)
Checks if the value is in the given array.
The method returns
{@code false}if a{@code null}array is passed in.- Parameters:
array- the array to search throughvalueToFind- the value to find
-
indexOf
static int indexOf(Array<byte> array, byte valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to find
-
indexOf
static int indexOf(Array<byte> array, byte valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex is treated as zero. A startIndex larger than the arraylength will return INDEX_NOT_FOUND (
{@code -1}).- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to findstartIndex- the index to start searching at
-
lastIndexOf
static int lastIndexOf(Array<byte> array, byte valueToFind)
Finds the last index of the given value within the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to travers backwords looking for the object, may be{@code null}valueToFind- the object to find
-
lastIndexOf
static int lastIndexOf(Array<byte> array, byte valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex will return INDEX_NOT_FOUND (
{@code -1}). A startIndex larger than thearray length will search from the end of the array.- Parameters:
array- the array to traverse for looking for the object, may be{@code null}valueToFind- the value to findstartIndex- the start index to travers backwards from
-
contains
static boolean contains(Array<byte> array, byte valueToFind)
Checks if the value is in the given array.
The method returns
{@code false}if a{@code null}array is passed in.- Parameters:
array- the array to search throughvalueToFind- the value to find
-
indexOf
static int indexOf(Array<double> array, double valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to find
-
indexOf
static int indexOf(Array<double> array, double valueToFind, double tolerance)
Finds the index of the given value within a given tolerance in the array.This method will return the index of the first value which falls between the regiondefined by valueToFind - tolerance and valueToFind + tolerance.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to findtolerance- tolerance of the search
-
indexOf
static int indexOf(Array<double> array, double valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex is treated as zero. A startIndex larger than the arraylength will return INDEX_NOT_FOUND (
{@code -1}).- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to findstartIndex- the index to start searching at
-
indexOf
static int indexOf(Array<double> array, double valueToFind, int startIndex, double tolerance)
Finds the index of the given value in the array starting at the given index.This method will return the index of the first value which falls between the regiondefined by valueToFind - tolerance and valueToFind + tolerance.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex is treated as zero. A startIndex larger than the arraylength will return INDEX_NOT_FOUND (
{@code -1}).- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to findstartIndex- the index to start searching attolerance- tolerance of the search
-
lastIndexOf
static int lastIndexOf(Array<double> array, double valueToFind)
Finds the last index of the given value within the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to travers backwords looking for the object, may be{@code null}valueToFind- the object to find
-
lastIndexOf
static int lastIndexOf(Array<double> array, double valueToFind, double tolerance)
Finds the last index of the given value within a given tolerance in the array.This method will return the index of the last value which falls between the regiondefined by valueToFind - tolerance and valueToFind + tolerance.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to findtolerance- tolerance of the search
-
lastIndexOf
static int lastIndexOf(Array<double> array, double valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex will return INDEX_NOT_FOUND (
{@code -1}). A startIndex larger than thearray length will search from the end of the array.- Parameters:
array- the array to traverse for looking for the object, may be{@code null}valueToFind- the value to findstartIndex- the start index to travers backwards from
-
lastIndexOf
static int lastIndexOf(Array<double> array, double valueToFind, int startIndex, double tolerance)
Finds the last index of the given value in the array starting at the given index.This method will return the index of the last value which falls between the regiondefined by valueToFind - tolerance and valueToFind + tolerance.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex will return INDEX_NOT_FOUND (
{@code -1}). A startIndex larger than thearray length will search from the end of the array.- Parameters:
array- the array to traverse for looking for the object, may be{@code null}valueToFind- the value to findstartIndex- the start index to travers backwards fromtolerance- search for value within plus/minus this amount
-
contains
static boolean contains(Array<double> array, double valueToFind)
Checks if the value is in the given array.
The method returns
{@code false}if a{@code null}array is passed in.- Parameters:
array- the array to search throughvalueToFind- the value to find
-
contains
static boolean contains(Array<double> array, double valueToFind, double tolerance)
Checks if a value falling within the given tolerance is in thegiven array. If the array contains a value within the inclusive rangedefined by (value - tolerance) to (value + tolerance).
The method returns
{@code false}if a{@code null}arrayis passed in.- Parameters:
array- the array to searchvalueToFind- the value to findtolerance- the array contains the tolerance of the search
-
indexOf
static int indexOf(Array<float> array, float valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to find
-
indexOf
static int indexOf(Array<float> array, float valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex is treated as zero. A startIndex larger than the arraylength will return INDEX_NOT_FOUND (
{@code -1}).- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to findstartIndex- the index to start searching at
-
lastIndexOf
static int lastIndexOf(Array<float> array, float valueToFind)
Finds the last index of the given value within the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to travers backwords looking for the object, may be{@code null}valueToFind- the object to find
-
lastIndexOf
static int lastIndexOf(Array<float> array, float valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex will return INDEX_NOT_FOUND (
{@code -1}). A startIndex larger than thearray length will search from the end of the array.- Parameters:
array- the array to traverse for looking for the object, may be{@code null}valueToFind- the value to findstartIndex- the start index to travers backwards from
-
contains
static boolean contains(Array<float> array, float valueToFind)
Checks if the value is in the given array.
The method returns
{@code false}if a{@code null}array is passed in.- Parameters:
array- the array to search throughvalueToFind- the value to find
-
indexOf
static int indexOf(Array<boolean> array, boolean valueToFind)
Finds the index of the given value in the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to find
-
indexOf
static int indexOf(Array<boolean> array, boolean valueToFind, int startIndex)
Finds the index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex is treated as zero. A startIndex larger than the arraylength will return INDEX_NOT_FOUND (
{@code -1}).- Parameters:
array- the array to search through for the object, may be{@code null}valueToFind- the value to findstartIndex- the index to start searching at
-
lastIndexOf
static int lastIndexOf(Array<boolean> array, boolean valueToFind)
Finds the last index of the given value within the array.
This method returns INDEX_NOT_FOUND (
{@code -1}) if{@code null}array input.- Parameters:
array- the array to travers backwords looking for the object, may be{@code null}valueToFind- the object to find
-
lastIndexOf
static int lastIndexOf(Array<boolean> array, boolean valueToFind, int startIndex)
Finds the last index of the given value in the array starting at the given index.
This method returns INDEX_NOT_FOUND (
{@code -1}) for a{@code null}input array.A negative startIndex will return INDEX_NOT_FOUND (
{@code -1}). A startIndex larger thanthe array length will search from the end of the array.- Parameters:
array- the array to traverse for looking for the object, may be{@code null}valueToFind- the value to findstartIndex- the start index to travers backwards from
-
contains
static boolean contains(Array<boolean> array, boolean valueToFind)
Checks if the value is in the given array.
The method returns
{@code false}if a{@code null}array is passed in.- Parameters:
array- the array to search throughvalueToFind- the value to find
-
toPrimitive
static Array<char> toPrimitive(Array<Character> array)
Converts an array of object Characters to primitives.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Character}array, may be{@code null}
-
toPrimitive
static Array<char> toPrimitive(Array<Character> array, char valueForNull)
Converts an array of object Character to primitives handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Character}array, may be{@code null}valueForNull- the value to insert if{@code null}found
-
toObject
static Array<Character> toObject(Array<char> array)
Converts an array of primitive chars to objects.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code char}array
-
toPrimitive
static Array<long> toPrimitive(Array<Long> array)
Converts an array of object Longs to primitives.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Long}array, may be{@code null}
-
toPrimitive
static Array<long> toPrimitive(Array<Long> array, long valueForNull)
Converts an array of object Long to primitives handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Long}array, may be{@code null}valueForNull- the value to insert if{@code null}found
-
toObject
static Array<Long> toObject(Array<long> array)
Converts an array of primitive longs to objects.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code long}array
-
toPrimitive
static Array<int> toPrimitive(Array<Integer> array)
Converts an array of object Integers to primitives.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Integer}array, may be{@code null}
-
toPrimitive
static Array<int> toPrimitive(Array<Integer> array, int valueForNull)
Converts an array of object Integer to primitives handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Integer}array, may be{@code null}valueForNull- the value to insert if{@code null}found
-
toObject
static Array<Integer> toObject(Array<int> array)
Converts an array of primitive ints to objects.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- an{@code int}array
-
toPrimitive
static Array<short> toPrimitive(Array<Short> array)
Converts an array of object Shorts to primitives.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Short}array, may be{@code null}
-
toPrimitive
static Array<short> toPrimitive(Array<Short> array, short valueForNull)
Converts an array of object Short to primitives handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Short}array, may be{@code null}valueForNull- the value to insert if{@code null}found
-
toObject
static Array<Short> toObject(Array<short> array)
Converts an array of primitive shorts to objects.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code short}array
-
toPrimitive
static Array<byte> toPrimitive(Array<Byte> array)
Converts an array of object Bytes to primitives.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Byte}array, may be{@code null}
-
toPrimitive
static Array<byte> toPrimitive(Array<Byte> array, byte valueForNull)
Converts an array of object Bytes to primitives handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Byte}array, may be{@code null}valueForNull- the value to insert if{@code null}found
-
toObject
static Array<Byte> toObject(Array<byte> array)
Converts an array of primitive bytes to objects.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code byte}array
-
toPrimitive
static Array<double> toPrimitive(Array<Double> array)
Converts an array of object Doubles to primitives.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Double}array, may be{@code null}
-
toPrimitive
static Array<double> toPrimitive(Array<Double> array, double valueForNull)
Converts an array of object Doubles to primitives handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Double}array, may be{@code null}valueForNull- the value to insert if{@code null}found
-
toObject
static Array<Double> toObject(Array<double> array)
Converts an array of primitive doubles to objects.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code double}array
-
toPrimitive
static Array<float> toPrimitive(Array<Float> array)
Converts an array of object Floats to primitives.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Float}array, may be{@code null}
-
toPrimitive
static Array<float> toPrimitive(Array<Float> array, float valueForNull)
Converts an array of object Floats to primitives handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Float}array, may be{@code null}valueForNull- the value to insert if{@code null}found
-
toObject
static Array<Float> toObject(Array<float> array)
Converts an array of primitive floats to objects.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code float}array
-
toPrimitive
static Array<boolean> toPrimitive(Array<Boolean> array)
Converts an array of object Booleans to primitives.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Boolean}array, may be{@code null}
-
toPrimitive
static Array<boolean> toPrimitive(Array<Boolean> array, boolean valueForNull)
Converts an array of object Booleans to primitives handling
{@code null}.This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code Boolean}array, may be{@code null}valueForNull- the value to insert if{@code null}found
-
toObject
static Array<Boolean> toObject(Array<boolean> array)
Converts an array of primitive booleans to objects.
This method returns
{@code null}for a{@code null}input array.- Parameters:
array- a{@code boolean}array
-
isEmpty
static boolean isEmpty(Array<Object> array)
Checks if an array of Objects is empty or
{@code null}.- Parameters:
array- the array to test
-
isEmpty
static boolean isEmpty(Array<long> array)
Checks if an array of primitive longs is empty or
{@code null}.- Parameters:
array- the array to test
-
isEmpty
static boolean isEmpty(Array<int> array)
Checks if an array of primitive ints is empty or
{@code null}.- Parameters:
array- the array to test
-
isEmpty
static boolean isEmpty(Array<short> array)
Checks if an array of primitive shorts is empty or
{@code null}.- Parameters:
array- the array to test
-
isEmpty
static boolean isEmpty(Array<char> array)
Checks if an array of primitive chars is empty or
{@code null}.- Parameters:
array- the array to test
-
isEmpty
static boolean isEmpty(Array<byte> array)
Checks if an array of primitive bytes is empty or
{@code null}.- Parameters:
array- the array to test
-
isEmpty
static boolean isEmpty(Array<double> array)
Checks if an array of primitive doubles is empty or
{@code null}.- Parameters:
array- the array to test
-
isEmpty
static boolean isEmpty(Array<float> array)
Checks if an array of primitive floats is empty or
{@code null}.- Parameters:
array- the array to test
-
isEmpty
static boolean isEmpty(Array<boolean> array)
Checks if an array of primitive booleans is empty or
{@code null}.- Parameters:
array- the array to test
-
isNotEmpty
static <T> boolean isNotEmpty(Array<T> array)
Checks if an array of Objects is not empty or not
{@code null}.- Parameters:
array- the array to test
-
isNotEmpty
static boolean isNotEmpty(Array<long> array)
Checks if an array of primitive longs is not empty or not
{@code null}.- Parameters:
array- the array to test
-
isNotEmpty
static boolean isNotEmpty(Array<int> array)
Checks if an array of primitive ints is not empty or not
{@code null}.- Parameters:
array- the array to test
-
isNotEmpty
static boolean isNotEmpty(Array<short> array)
Checks if an array of primitive shorts is not empty or not
{@code null}.- Parameters:
array- the array to test
-
isNotEmpty
static boolean isNotEmpty(Array<char> array)
Checks if an array of primitive chars is not empty or not
{@code null}.- Parameters:
array- the array to test
-
isNotEmpty
static boolean isNotEmpty(Array<byte> array)
Checks if an array of primitive bytes is not empty or not
{@code null}.- Parameters:
array- the array to test
-
isNotEmpty
static boolean isNotEmpty(Array<double> array)
Checks if an array of primitive doubles is not empty or not
{@code null}.- Parameters:
array- the array to test
-
isNotEmpty
static boolean isNotEmpty(Array<float> array)
Checks if an array of primitive floats is not empty or not
{@code null}.- Parameters:
array- the array to test
-
isNotEmpty
static boolean isNotEmpty(Array<boolean> array)
Checks if an array of primitive booleans is not empty or not
{@code null}.- Parameters:
array- the array to test
-
addAll
static <T> Array<T> addAll(Array<T> array1, Array<T> array2)
Adds all the elements of the given arrays into a new array.
The new array contains all of the element of
{@code array1}followedby all of the elements{@code array2}. When an array is returned, it is alwaysa new array.ArrayUtils.addAll(null, null) = null ArrayUtils.addAll(array1, null) = cloned copy of array1 ArrayUtils.addAll(null, array2) = cloned copy of array2 ArrayUtils.addAll([], []) = [] ArrayUtils.addAll([null], [null]) = [null, null] ArrayUtils.addAll(["a", "b", "c"], ["1", "2", "3"]) = ["a", "b", "c", "1", "2", "3"]- Parameters:
array1- the first array whose elements are added to the new array, may be{@code null}array2- the second array whose elements are added to the new array, may be{@code null}
-
addAll
static Array<boolean> addAll(Array<boolean> array1, Array<boolean> array2)
Adds all the elements of the given arrays into a new array.
The new array contains all of the element of
{@code array1}followedby all of the elements{@code array2}. When an array is returned, it is alwaysa new array.ArrayUtils.addAll(array1, null) = cloned copy of array1 ArrayUtils.addAll(null, array2) = cloned copy of array2 ArrayUtils.addAll([], []) = []- Parameters:
array1- the first array whose elements are added to the new array.array2- the second array whose elements are added to the new array.
-
addAll
static Array<char> addAll(Array<char> array1, Array<char> array2)
Adds all the elements of the given arrays into a new array.
The new array contains all of the element of
{@code array1}followedby all of the elements{@code array2}. When an array is returned, it is alwaysa new array.ArrayUtils.addAll(array1, null) = cloned copy of array1 ArrayUtils.addAll(null, array2) = cloned copy of array2 ArrayUtils.addAll([], []) = []- Parameters:
array1- the first array whose elements are added to the new array.array2- the second array whose elements are added to the new array.
-
addAll
static Array<byte> addAll(Array<byte> array1, Array<byte> array2)
Adds all the elements of the given arrays into a new array.
The new array contains all of the element of
{@code array1}followedby all of the elements{@code array2}. When an array is returned, it is alwaysa new array.ArrayUtils.addAll(array1, null) = cloned copy of array1 ArrayUtils.addAll(null, array2) = cloned copy of array2 ArrayUtils.addAll([], []) = []- Parameters:
array1- the first array whose elements are added to the new array.array2- the second array whose elements are added to the new array.
-
addAll
static Array<short> addAll(Array<short> array1, Array<short> array2)
Adds all the elements of the given arrays into a new array.
The new array contains all of the element of
{@code array1}followedby all of the elements{@code array2}. When an array is returned, it is alwaysa new array.ArrayUtils.addAll(array1, null) = cloned copy of array1 ArrayUtils.addAll(null, array2) = cloned copy of array2 ArrayUtils.addAll([], []) = []- Parameters:
array1- the first array whose elements are added to the new array.array2- the second array whose elements are added to the new array.
-
addAll
static Array<int> addAll(Array<int> array1, Array<int> array2)
Adds all the elements of the given arrays into a new array.
The new array contains all of the element of
{@code array1}followedby all of the elements{@code array2}. When an array is returned, it is alwaysa new array.ArrayUtils.addAll(array1, null) = cloned copy of array1 ArrayUtils.addAll(null, array2) = cloned copy of array2 ArrayUtils.addAll([], []) = []- Parameters:
array1- the first array whose elements are added to the new array.array2- the second array whose elements are added to the new array.
-
addAll
static Array<long> addAll(Array<long> array1, Array<long> array2)
Adds all the elements of the given arrays into a new array.
The new array contains all of the element of
{@code array1}followedby all of the elements{@code array2}. When an array is returned, it is alwaysa new array.ArrayUtils.addAll(array1, null) = cloned copy of array1 ArrayUtils.addAll(null, array2) = cloned copy of array2 ArrayUtils.addAll([], []) = []- Parameters:
array1- the first array whose elements are added to the new array.array2- the second array whose elements are added to the new array.
-
addAll
static Array<float> addAll(Array<float> array1, Array<float> array2)
Adds all the elements of the given arrays into a new array.
The new array contains all of the element of
{@code array1}followedby all of the elements{@code array2}. When an array is returned, it is alwaysa new array.ArrayUtils.addAll(array1, null) = cloned copy of array1 ArrayUtils.addAll(null, array2) = cloned copy of array2 ArrayUtils.addAll([], []) = []- Parameters:
array1- the first array whose elements are added to the new array.array2- the second array whose elements are added to the new array.
-
addAll
static Array<double> addAll(Array<double> array1, Array<double> array2)
Adds all the elements of the given arrays into a new array.
The new array contains all of the element of
{@code array1}followedby all of the elements{@code array2}. When an array is returned, it is alwaysa new array.ArrayUtils.addAll(array1, null) = cloned copy of array1 ArrayUtils.addAll(null, array2) = cloned copy of array2 ArrayUtils.addAll([], []) = []- Parameters:
array1- the first array whose elements are added to the new array.array2- the second array whose elements are added to the new array.
-
add
static <T> Array<T> add(Array<T> array, T element)
Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the inputarray plus the given element in the last position. The component type ofthe new array is the same as that of the input array.
If the input array is
{@code null}, a new one element array is returnedwhose 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) = [null] ArrayUtils.add(null, "a") = ["a"] ArrayUtils.add(["a"], null) = ["a", null] ArrayUtils.add(["a"], "b") = ["a", "b"] ArrayUtils.add(["a", "b"], "c") = ["a", "b", "c"]- Parameters:
array- the array to "add" the element to, may be{@code null}element- the object to add, may be{@code null}
-
add
static Array<boolean> add(Array<boolean> array, boolean element)
Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the inputarray plus the given element in the last position. The component type ofthe new array is the same as that of the input array.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}element- the object to add at the last index of the new array
-
add
static Array<byte> add(Array<byte> array, byte element)
Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the inputarray plus the given element in the last position. The component type ofthe new array is the same as that of the input array.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}element- the object to add at the last index of the new array
-
add
static Array<char> add(Array<char> array, char element)
Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the inputarray plus the given element in the last position. The component type ofthe new array is the same as that of the input array.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}element- the object to add at the last index of the new array
-
add
static Array<double> add(Array<double> array, double element)
Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the inputarray plus the given element in the last position. The component type ofthe new array is the same as that of the input array.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}element- the object to add at the last index of the new array
-
add
static Array<float> add(Array<float> array, float element)
Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the inputarray plus the given element in the last position. The component type ofthe new array is the same as that of the input array.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}element- the object to add at the last index of the new array
-
add
static Array<int> add(Array<int> array, int element)
Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the inputarray plus the given element in the last position. The component type ofthe new array is the same as that of the input array.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}element- the object to add at the last index of the new array
-
add
static Array<long> add(Array<long> array, long element)
Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the inputarray plus the given element in the last position. The component type ofthe new array is the same as that of the input array.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}element- the object to add at the last index of the new array
-
add
static Array<short> add(Array<short> array, short element)
Copies the given array and adds the given element at the end of the new array.
The new array contains the same elements of the inputarray plus the given element in the last position. The component type ofthe new array is the same as that of the input array.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}element- the object to add at the last index of the new array
-
add
static <T> Array<T> add(Array<T> array, int index, T element)
Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices).
This method returns a new array with the same elements of the inputarray plus the given element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, a new one element array is returnedwhose component type is the same as the element.ArrayUtils.add(null, 0, null) = [null] ArrayUtils.add(null, 0, "a") = ["a"] ArrayUtils.add(["a"], 1, null) = ["a", null] ArrayUtils.add(["a"], 1, "b") = ["a", "b"] ArrayUtils.add(["a", "b"], 3, "c") = ["a", "b", "c"]- Parameters:
array- the array to add the element to, may be{@code null}index- the position of the new objectelement- the object to add
-
add
static Array<boolean> add(Array<boolean> array, int index, boolean element)
Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices).
This method returns a new array with the same elements of the inputarray plus the given element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}index- the position of the new objectelement- the object to add
-
add
static Array<char> add(Array<char> array, int index, char element)
Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices).
This method returns a new array with the same elements of the inputarray plus the given element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}index- the position of the new objectelement- the object to add
-
add
static Array<byte> add(Array<byte> array, int index, byte element)
Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices).
This method returns a new array with the same elements of the inputarray plus the given element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}index- the position of the new objectelement- the object to add
-
add
static Array<short> add(Array<short> array, int index, short element)
Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices).
This method returns a new array with the same elements of the inputarray plus the given element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}index- the position of the new objectelement- the object to add
-
add
static Array<int> add(Array<int> array, int index, int element)
Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices).
This method returns a new array with the same elements of the inputarray plus the given element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}index- the position of the new objectelement- the object to add
-
add
static Array<long> add(Array<long> array, int index, long element)
Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices).
This method returns a new array with the same elements of the inputarray plus the given element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}index- the position of the new objectelement- the object to add
-
add
static Array<float> add(Array<float> array, int index, float element)
Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices).
This method returns a new array with the same elements of the inputarray plus the given element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}index- the position of the new objectelement- the object to add
-
add
static Array<double> add(Array<double> array, int index, double element)
Inserts the specified element at the specified position in the array.Shifts the element currently at that position (if any) and any subsequentelements to the right (adds one to their indices).
This method returns a new array with the same elements of the inputarray plus the given element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, a new one element array is returnedwhose 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{@code null}index- the position of the new objectelement- the object to add
-
remove
static <T> Array<T> remove(Array<T> array, int index)
Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices).
This method returns a new array with the same elements of the inputarray except the element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}index- the position of the element to be removed
-
removeElement
static <T> Array<T> removeElement(Array<T> array, Object element)
Removes the first occurrence of the specified element from thespecified array. All subsequent elements are shifted to the left(subtracts one from their indices). If the array doesn't containssuch an element, no elements are removed from the array.
This method returns a new array with the same elements of the inputarray except the first occurrence of the specified element. The componenttype of the returned array is always the same as that of the inputarray.
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{@code null}element- the element to be removed
-
remove
static Array<boolean> remove(Array<boolean> array, int index)
Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices).
This method returns a new array with the same elements of the inputarray except the element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}index- the position of the element to be removed
-
removeElement
static Array<boolean> removeElement(Array<boolean> array, boolean element)
Removes the first occurrence of the specified element from thespecified array. All subsequent elements are shifted to the left(subtracts one from their indices). If the array doesn't containssuch an element, no elements are removed from the array.
This method returns a new array with the same elements of the inputarray except the first occurrence of the specified element. The componenttype of the returned array is always the same as that of the inputarray.
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{@code null}element- the element to be removed
-
remove
static Array<byte> remove(Array<byte> array, int index)
Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices).
This method returns a new array with the same elements of the inputarray except the element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}index- the position of the element to be removed
-
removeElement
static Array<byte> removeElement(Array<byte> array, byte element)
Removes the first occurrence of the specified element from thespecified array. All subsequent elements are shifted to the left(subtracts one from their indices). If the array doesn't containssuch an element, no elements are removed from the array.
This method returns a new array with the same elements of the inputarray except the first occurrence of the specified element. The componenttype of the returned array is always the same as that of the inputarray.
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{@code null}element- the element to be removed
-
remove
static Array<char> remove(Array<char> array, int index)
Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices).
This method returns a new array with the same elements of the inputarray except the element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}index- the position of the element to be removed
-
removeElement
static Array<char> removeElement(Array<char> array, char element)
Removes the first occurrence of the specified element from thespecified array. All subsequent elements are shifted to the left(subtracts one from their indices). If the array doesn't containssuch an element, no elements are removed from the array.
This method returns a new array with the same elements of the inputarray except the first occurrence of the specified element. The componenttype of the returned array is always the same as that of the inputarray.
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{@code null}element- the element to be removed
-
remove
static Array<double> remove(Array<double> array, int index)
Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices).
This method returns a new array with the same elements of the inputarray except the element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}index- the position of the element to be removed
-
removeElement
static Array<double> removeElement(Array<double> array, double element)
Removes the first occurrence of the specified element from thespecified array. All subsequent elements are shifted to the left(subtracts one from their indices). If the array doesn't containssuch an element, no elements are removed from the array.
This method returns a new array with the same elements of the inputarray except the first occurrence of the specified element. The componenttype of the returned array is always the same as that of the inputarray.
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{@code null}element- the element to be removed
-
remove
static Array<float> remove(Array<float> array, int index)
Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices).
This method returns a new array with the same elements of the inputarray except the element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}index- the position of the element to be removed
-
removeElement
static Array<float> removeElement(Array<float> array, float element)
Removes the first occurrence of the specified element from thespecified array. All subsequent elements are shifted to the left(subtracts one from their indices). If the array doesn't containssuch an element, no elements are removed from the array.
This method returns a new array with the same elements of the inputarray except the first occurrence of the specified element. The componenttype of the returned array is always the same as that of the inputarray.
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{@code null}element- the element to be removed
-
remove
static Array<int> remove(Array<int> array, int index)
Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices).
This method returns a new array with the same elements of the inputarray except the element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}index- the position of the element to be removed
-
removeElement
static Array<int> removeElement(Array<int> array, int element)
Removes the first occurrence of the specified element from thespecified array. All subsequent elements are shifted to the left(subtracts one from their indices). If the array doesn't containssuch an element, no elements are removed from the array.
This method returns a new array with the same elements of the inputarray except the first occurrence of the specified element. The componenttype of the returned array is always the same as that of the inputarray.
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{@code null}element- the element to be removed
-
remove
static Array<long> remove(Array<long> array, int index)
Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices).
This method returns a new array with the same elements of the inputarray except the element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}index- the position of the element to be removed
-
removeElement
static Array<long> removeElement(Array<long> array, long element)
Removes the first occurrence of the specified element from thespecified array. All subsequent elements are shifted to the left(subtracts one from their indices). If the array doesn't containssuch an element, no elements are removed from the array.
This method returns a new array with the same elements of the inputarray except the first occurrence of the specified element. The componenttype of the returned array is always the same as that of the inputarray.
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{@code null}element- the element to be removed
-
remove
static Array<short> remove(Array<short> array, int index)
Removes the element at the specified position from the specified array.All subsequent elements are shifted to the left (subtracts one fromtheir indices).
This method returns a new array with the same elements of the inputarray except the element on the specified position. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}index- the position of the element to be removed
-
removeElement
static Array<short> removeElement(Array<short> array, short element)
Removes the first occurrence of the specified element from thespecified array. All subsequent elements are shifted to the left(subtracts one from their indices). If the array doesn't containssuch an element, no elements are removed from the array.
This method returns a new array with the same elements of the inputarray except the first occurrence of the specified element. The componenttype of the returned array is always the same as that of the inputarray.
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{@code null}element- the element to be removed
-
removeAll
static <T> Array<T> removeAll(Array<T> array, Array<int> indices)
Removes 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 inputarray except those at the specified positions. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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"]- Parameters:
array- the array to remove the element from, may not be{@code null}indices- the positions of the elements to be removed
-
removeElements
static <T> Array<T> removeElements(Array<T> array, Array<T> values)
Removes 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 thancontained in the original array, no change occurs beyond theremoval of the existing matching items.
This method returns a new array with the same elements of the inputarray except for the earliest-encountered occurrences of the specifiedelements. The component type of the returned array is always the sameas 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"]- Parameters:
array- the array to remove the element from, may be{@code null}values- the elements to be removed
-
removeAll
static Array<byte> removeAll(Array<byte> array, Array<int> indices)
Removes 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 inputarray except those at the specified positions. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}indices- the positions of the elements to be removed
-
removeElements
static Array<byte> removeElements(Array<byte> array, Array<byte> values)
Removes 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 thancontained in the original array, no change occurs beyond theremoval of the existing matching items.
This method returns a new array with the same elements of the inputarray except for the earliest-encountered occurrences of the specifiedelements. The component type of the returned array is always the sameas 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{@code null}values- the elements to be removed
-
removeAll
static Array<short> removeAll(Array<short> array, Array<int> indices)
Removes 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 inputarray except those at the specified positions. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}indices- the positions of the elements to be removed
-
removeElements
static Array<short> removeElements(Array<short> array, Array<short> values)
Removes 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 thancontained in the original array, no change occurs beyond theremoval of the existing matching items.
This method returns a new array with the same elements of the inputarray except for the earliest-encountered occurrences of the specifiedelements. The component type of the returned array is always the sameas 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{@code null}values- the elements to be removed
-
removeAll
static Array<int> removeAll(Array<int> array, Array<int> indices)
Removes 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 inputarray except those at the specified positions. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}indices- the positions of the elements to be removed
-
removeElements
static Array<int> removeElements(Array<int> array, Array<int> values)
Removes 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 thancontained in the original array, no change occurs beyond theremoval of the existing matching items.
This method returns a new array with the same elements of the inputarray except for the earliest-encountered occurrences of the specifiedelements. The component type of the returned array is always the sameas 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{@code null}values- the elements to be removed
-
removeAll
static Array<char> removeAll(Array<char> array, Array<int> indices)
Removes 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 inputarray except those at the specified positions. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}indices- the positions of the elements to be removed
-
removeElements
static Array<char> removeElements(Array<char> array, Array<char> values)
Removes 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 thancontained in the original array, no change occurs beyond theremoval of the existing matching items.
This method returns a new array with the same elements of the inputarray except for the earliest-encountered occurrences of the specifiedelements. The component type of the returned array is always the sameas 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{@code null}values- the elements to be removed
-
removeAll
static Array<long> removeAll(Array<long> array, Array<int> indices)
Removes 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 inputarray except those at the specified positions. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}indices- the positions of the elements to be removed
-
removeElements
static Array<long> removeElements(Array<long> array, Array<long> values)
Removes 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 thancontained in the original array, no change occurs beyond theremoval of the existing matching items.
This method returns a new array with the same elements of the inputarray except for the earliest-encountered occurrences of the specifiedelements. The component type of the returned array is always the sameas 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{@code null}values- the elements to be removed
-
removeAll
static Array<float> removeAll(Array<float> array, Array<int> indices)
Removes 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 inputarray except those at the specified positions. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}indices- the positions of the elements to be removed
-
removeElements
static Array<float> removeElements(Array<float> array, Array<float> values)
Removes 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 thancontained in the original array, no change occurs beyond theremoval of the existing matching items.
This method returns a new array with the same elements of the inputarray except for the earliest-encountered occurrences of the specifiedelements. The component type of the returned array is always the sameas 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{@code null}values- the elements to be removed
-
removeAll
static Array<double> removeAll(Array<double> array, Array<int> indices)
Removes 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 inputarray except those at the specified positions. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}indices- the positions of the elements to be removed
-
removeElements
static Array<double> removeElements(Array<double> array, Array<double> values)
Removes 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 thancontained in the original array, no change occurs beyond theremoval of the existing matching items.
This method returns a new array with the same elements of the inputarray except for the earliest-encountered occurrences of the specifiedelements. The component type of the returned array is always the sameas 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{@code null}values- the elements to be removed
-
removeAll
static Array<boolean> removeAll(Array<boolean> array, Array<int> indices)
Removes 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 inputarray except those at the specified positions. The componenttype of the returned array is always the same as that of the inputarray.
If the input array is
{@code null}, an IndexOutOfBoundsExceptionwill 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{@code null}indices- the positions of the elements to be removed
-
removeElements
static Array<boolean> removeElements(Array<boolean> array, Array<boolean> values)
Removes 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 thancontained in the original array, no change occurs beyond theremoval of the existing matching items.
This method returns a new array with the same elements of the inputarray except for the earliest-encountered occurrences of the specifiedelements. The component type of the returned array is always the sameas 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{@code null}values- the elements to be removed
-
-
-
-