java.lang.Object | |
↳ | java.util.Arrays |
Arrays
contains static methods which operate on arrays.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
static <T> List<T> |
asList(T... a)
Returns a fixed-size list backed by the specified array.
| ||||||||||
static int |
binarySearch(char[] array, int startIndex, int endIndex, char value)
Performs a binary search for the specified element in a part of the specified
sorted array.
| ||||||||||
static int |
binarySearch(long[] array, long value)
Performs a binary search for the specified element in the specified sorted
array.
| ||||||||||
static <T> int |
binarySearch(Object[] array, int startIndex, int endIndex, Object object, Comparator<? super T> comparator)
Performs a binary search for the specified element in a part of the specified
sorted array using the Comparator to compare elements.
| ||||||||||
static int |
binarySearch(float[] array, int startIndex, int endIndex, float value)
Performs a binary search for the specified element in a part of the specified
sorted array.
| ||||||||||
static int |
binarySearch(byte[] array, int startIndex, int endIndex, byte value)
Performs a binary search for the specified element in a part of the specified
sorted array.
| ||||||||||
static int |
binarySearch(long[] array, int startIndex, int endIndex, long value)
Performs a binary search for the specified element in a part of the specified
sorted array.
| ||||||||||
static int |
binarySearch(Object[] array, int startIndex, int endIndex, Object object)
Performs a binary search for the specified element in a part of the specified
sorted array.
| ||||||||||
static int |
binarySearch(char[] array, char value)
Performs a binary search for the specified element in the specified sorted
array.
| ||||||||||
static int |
binarySearch(int[] array, int value)
Performs a binary search for the specified element in the specified sorted
array.
| ||||||||||
static int |
binarySearch(int[] array, int startIndex, int endIndex, int value)
Performs a binary search for the specified element in a part of the specified
sorted array.
| ||||||||||
static int |
binarySearch(short[] array, int startIndex, int endIndex, short value)
Performs a binary search for the specified element in a part of the specified
sorted array.
| ||||||||||
static <T> int |
binarySearch(Object[] array, Object object, Comparator<? super T> comparator)
Performs a binary search for the specified element in the specified sorted
array using the Comparator to compare elements.
| ||||||||||
static int |
binarySearch(byte[] array, byte value)
Performs a binary search for the specified element in the specified ascending
sorted array.
| ||||||||||
static int |
binarySearch(double[] array, double value)
Performs a binary search for the specified element in the specified sorted
array.
| ||||||||||
static int |
binarySearch(short[] array, short value)
Performs a binary search for the specified element in the specified sorted
array.
| ||||||||||
static int |
binarySearch(Object[] array, Object object)
Performs a binary search for the specified element in the specified sorted
array.
| ||||||||||
static int |
binarySearch(float[] array, float value)
Performs a binary search for the specified element in the specified sorted
array.
| ||||||||||
static int |
binarySearch(double[] array, int startIndex, int endIndex, double value)
Performs a binary search for the specified element in a part of the specified
sorted array.
| ||||||||||
static char[] |
copyOf(char[] original, int newLength)
Copies the specified array, truncating or padding with null characters (if
necessary) so the copy has the specified length.
| ||||||||||
static double[] |
copyOfRange(double[] original, int start, int end)
Copies elements in original array to a new array, from index start(inclusive)
to end(exclusive).
| ||||||||||
static boolean[] |
copyOfRange(boolean[] original, int start, int end)
Copies elements in original array to a new array, from index start(inclusive)
to end(exclusive).
| ||||||||||
static short[] |
copyOfRange(short[] original, int start, int end)
Copies elements in original array to a new array, from index start(inclusive)
to end(exclusive).
| ||||||||||
static char[] |
copyOfRange(char[] original, int start, int end)
Copies elements in original array to a new array, from index start(inclusive)
to end(exclusive).
| ||||||||||
static float[] |
copyOfRange(float[] original, int start, int end)
Copies elements in original array to a new array, from index start(inclusive)
to end(exclusive).
| ||||||||||
static long[] |
copyOfRange(long[] original, int start, int end)
Copies elements in original array to a new array, from index start(inclusive)
to end(exclusive).
| ||||||||||
static int[] |
copyOfRange(int[] original, int start, int end)
Copies elements in original array to a new array, from index start(inclusive)
to end(exclusive).
| ||||||||||
static byte[] |
copyOfRange(byte[] original, int start, int end)
Copies elements in original array to a new array, from index start(inclusive)
to end(exclusive).
| ||||||||||
static boolean |
deepEquals(Object[] array1, Object[] array2)
Returns
true if the two given arrays are deeply equal to one another. | ||||||||||
static int |
deepHashCode(Object[] array)
Returns a hash code based on the "deep contents" of the given array.
| ||||||||||
static String |
deepToString(Object[] array)
Creates a "deep"
String representation of the Object[]
passed, such that if the array contains other arrays, the String
representation of those arrays is generated as well. | ||||||||||
static boolean |
equals(Object[] array1, Object[] array2)
Compares the two arrays.
| ||||||||||
static boolean |
equals(double[] array1, double[] array2)
Compares the two arrays.
| ||||||||||
static boolean |
equals(long[] array1, long[] array2)
Compares the two arrays.
| ||||||||||
static boolean |
equals(float[] array1, float[] array2)
Compares the two arrays.
| ||||||||||
static boolean |
equals(short[] array1, short[] array2)
Compares the two arrays.
| ||||||||||
static boolean |
equals(byte[] array1, byte[] array2)
Compares the two arrays.
| ||||||||||
static boolean |
equals(char[] array1, char[] array2)
Compares the two arrays.
| ||||||||||
static boolean |
equals(boolean[] array1, boolean[] array2)
Compares the two arrays.
| ||||||||||
static boolean |
equals(int[] array1, int[] array2)
Compares the two arrays.
| ||||||||||
static void |
fill(float[] array, int start, int end, float value)
Fills the specified range in the array with the specified element.
| ||||||||||
static void |
fill(long[] array, long value)
Fills the specified array with the specified element.
| ||||||||||
static void |
fill(float[] array, float value)
Fills the specified array with the specified element.
| ||||||||||
static void |
fill(long[] array, int start, int end, long value)
Fills the specified range in the array with the specified element.
| ||||||||||
static void |
fill(byte[] array, byte value)
Fills the specified array with the specified element.
| ||||||||||
static void |
fill(byte[] array, int start, int end, byte value)
Fills the specified range in the array with the specified element.
| ||||||||||
static void |
fill(char[] array, char value)
Fills the specified array with the specified element.
| ||||||||||
static void |
fill(int[] array, int start, int end, int value)
Fills the specified range in the array with the specified element.
| ||||||||||
static void |
fill(double[] array, int start, int end, double value)
Fills the specified range in the array with the specified element.
| ||||||||||
static void |
fill(boolean[] array, int start, int end, boolean value)
Fills the specified range in the array with the specified element.
| ||||||||||
static void |
fill(short[] array, int start, int end, short value)
Fills the specified range in the array with the specified element.
| ||||||||||
static void |
fill(char[] array, int start, int end, char value)
Fills the specified range in the array with the specified element.
| ||||||||||
static void |
fill(boolean[] array, boolean value)
Fills the specified array with the specified element.
| ||||||||||
static void |
fill(short[] array, short value)
Fills the specified array with the specified element.
| ||||||||||
static void |
fill(Object[] array, Object value)
Fills the specified array with the specified element.
| ||||||||||
static void |
fill(Object[] array, int start, int end, Object value)
Fills the specified range in the array with the specified element.
| ||||||||||
static void |
fill(double[] array, double value)
Fills the specified array with the specified element.
| ||||||||||
static void |
fill(int[] array, int value)
Fills the specified array with the specified element.
| ||||||||||
static int |
hashCode(byte[] array)
Returns a hash code based on the contents of the given array.
| ||||||||||
static int |
hashCode(int[] array)
Returns a hash code based on the contents of the given array.
| ||||||||||
static int |
hashCode(float[] array)
Returns a hash code based on the contents of the given array.
| ||||||||||
static int |
hashCode(boolean[] array)
Returns a hash code based on the contents of the given array.
| ||||||||||
static int |
hashCode(short[] array)
Returns a hash code based on the contents of the given array.
| ||||||||||
static int |
hashCode(char[] array)
Returns a hash code based on the contents of the given array.
| ||||||||||
static int |
hashCode(Object[] array)
Returns a hash code based on the contents of the given array.
| ||||||||||
static int |
hashCode(long[] array)
Returns a hash code based on the contents of the given array.
| ||||||||||
static int |
hashCode(double[] array)
Returns a hash code based on the contents of the given array.
| ||||||||||
static void |
sort(int[] array)
Sorts the specified array in ascending numerical order.
| ||||||||||
static void |
sort(Object[] array, int start, int end)
Sorts the specified range in the array in ascending natural order.
| ||||||||||
static void |
sort(long[] array, int start, int end)
Sorts the specified range in the array in ascending numerical order.
| ||||||||||
static void |
sort(char[] array)
Sorts the specified array in ascending numerical order.
| ||||||||||
static void |
sort(double[] array, int start, int end)
Sorts the specified range in the array in ascending numerical order.
| ||||||||||
static void |
sort(double[] array)
Sorts the specified array in ascending numerical order.
| ||||||||||
static void |
sort(Object[] array)
Sorts the specified array in ascending natural order.
| ||||||||||
static void |
sort(short[] array)
Sorts the specified array in ascending numerical order.
| ||||||||||
static void |
sort(char[] array, int start, int end)
Sorts the specified range in the array in ascending numerical order.
| ||||||||||
static void |
sort(long[] array)
Sorts the specified array in ascending numerical order.
| ||||||||||
static void |
sort(int[] array, int start, int end)
Sorts the specified range in the array in ascending numerical order.
| ||||||||||
static void |
sort(byte[] array, int start, int end)
Sorts the specified range in the array in ascending numerical order.
| ||||||||||
static <T> void |
sort(Object[] array, int start, int end, Comparator<? super T> comparator)
Sorts the specified range in the array using the specified
Comparator . | ||||||||||
static void |
sort(float[] array, int start, int end)
Sorts the specified range in the array in ascending numerical order.
| ||||||||||
static void |
sort(short[] array, int start, int end)
Sorts the specified range in the array in ascending numerical order.
| ||||||||||
static void |
sort(float[] array)
Sorts the specified array in ascending numerical order.
| ||||||||||
static <T> void |
sort(Object[] array, Comparator<? super T> comparator)
Sorts the specified array using the specified
Comparator . | ||||||||||
static void |
sort(byte[] array)
Sorts the specified array in ascending numerical order.
| ||||||||||
static String |
toString(float[] array)
Creates a
String representation of the float[] passed. | ||||||||||
static String |
toString(int[] array)
Creates a
String representation of the int[] passed. | ||||||||||
static String |
toString(char[] array)
Creates a
String representation of the char[] passed. | ||||||||||
static String |
toString(Object[] array)
Creates a
String representation of the Object[] passed. | ||||||||||
static String |
toString(byte[] array)
Creates a
String representation of the byte[] passed. | ||||||||||
static String |
toString(long[] array)
Creates a
String representation of the long[] passed. | ||||||||||
static String |
toString(boolean[] array)
Creates a
String representation of the boolean[] passed. | ||||||||||
static String |
toString(double[] array)
Creates a
String representation of the double[] passed. | ||||||||||
static String |
toString(short[] array)
Creates a
String representation of the short[] passed. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Returns a fixed-size list backed by the specified array. (Changes to the
returned list "write through" to the array.) This method acts as bridge
between array-based and collection-based APIs, in combination with
toArray()
. The returned list is serializable and implements
RandomAccess
.
This method also provides a convenient way to create a fixed-size list initialized to contain several elements:
List<String> stooges = Arrays.asList("Larry", "Moe", "Curly");
a | the array by which the list will be backed |
---|
Performs a binary search for the specified element in a part of the specified sorted array.
array | the sorted char array to search |
---|---|
startIndex | the inclusive start index |
endIndex | the exclusive end index |
value | the char element to find |
IllegalArgumentException | - if startIndex is bigger than endIndex |
---|---|
ArrayIndexOutOfBoundsException | - if startIndex is smaller than zero or or endIndex is bigger than length of array |
Performs a binary search for the specified element in the specified sorted array.
array | the sorted long array to search |
---|---|
value | the long element to find |
Performs a binary search for the specified element in a part of the specified sorted array using the Comparator to compare elements.
array | the sorted Object array to search |
---|---|
startIndex | the inclusive start index |
endIndex | the exclusive end index |
object | the value element to find |
comparator | the Comparator |
ClassCastException | when an element in the array and the search element cannot be compared to each other using the Comparator |
---|---|
IllegalArgumentException | - if startIndex is bigger than endIndex |
ArrayIndexOutOfBoundsException | - if startIndex is smaller than zero or or endIndex is bigger than length of array |
Performs a binary search for the specified element in a part of the specified sorted array.
array | the sorted float array to search |
---|---|
startIndex | the inclusive start index |
endIndex | the exclusive end index |
value | the float element to find |
IllegalArgumentException | - if startIndex is bigger than endIndex |
---|---|
ArrayIndexOutOfBoundsException | - if startIndex is smaller than zero or or endIndex is bigger than length of array |
Performs a binary search for the specified element in a part of the specified sorted array.
array | the sorted byte array to search |
---|---|
startIndex | the inclusive start index |
endIndex | the exclusive end index |
value | the byte element to find |
IllegalArgumentException | - if startIndex is bigger than endIndex |
---|---|
ArrayIndexOutOfBoundsException | - if startIndex is smaller than zero or or endIndex is bigger than length of array |
Performs a binary search for the specified element in a part of the specified sorted array.
array | the sorted long array to search |
---|---|
startIndex | the inclusive start index |
endIndex | the exclusive end index |
value | the long element to find |
IllegalArgumentException | - if startIndex is bigger than endIndex |
---|---|
ArrayIndexOutOfBoundsException | - if startIndex is smaller than zero or or endIndex is bigger than length of array |
Performs a binary search for the specified element in a part of the specified sorted array.
array | the sorted Object array to search |
---|---|
startIndex | the inclusive start index |
endIndex | the exclusive end index |
object | the object element to find |
ClassCastException | when an element in the array or the search element does not implement Comparable, or cannot be compared to each other |
---|---|
IllegalArgumentException | - if startIndex is bigger than endIndex |
ArrayIndexOutOfBoundsException | - if startIndex is smaller than zero or or endIndex is bigger than length of array |
Performs a binary search for the specified element in the specified sorted array.
array | the sorted char array to search |
---|---|
value | the char element to find |
Performs a binary search for the specified element in the specified sorted array.
array | the sorted int array to search |
---|---|
value | the int element to find |
Performs a binary search for the specified element in a part of the specified sorted array.
array | the sorted int array to search |
---|---|
startIndex | the inclusive start index |
endIndex | the exclusive end index |
value | the int element to find |
IllegalArgumentException | - if startIndex is bigger than endIndex |
---|---|
ArrayIndexOutOfBoundsException | - if startIndex is smaller than zero or or endIndex is bigger than length of array |
Performs a binary search for the specified element in a part of the specified sorted array.
array | the sorted short array to search |
---|---|
startIndex | the inclusive start index |
endIndex | the exclusive end index |
value | the short element to find |
IllegalArgumentException | - if startIndex is bigger than endIndex |
---|---|
ArrayIndexOutOfBoundsException | - if startIndex is smaller than zero or or endIndex is bigger than length of array |
Performs a binary search for the specified element in the specified sorted array using the Comparator to compare elements.
array | the sorted Object array to search |
---|---|
object | the char element to find |
comparator | the Comparator |
ClassCastException | when an element in the array and the search element cannot be compared to each other using the Comparator |
---|
Performs a binary search for the specified element in the specified ascending sorted array. Searching in an unsorted array has an undefined result. It's also undefined which element is found if there are multiple occurrences of the same element.
array | the sorted byte array to search. |
---|---|
value | the byte element to find. |
-index - 1
where the element would be inserted.
Performs a binary search for the specified element in the specified sorted array.
array | the sorted double array to search |
---|---|
value | the double element to find |
Performs a binary search for the specified element in the specified sorted array.
array | the sorted short array to search |
---|---|
value | the short element to find |
Performs a binary search for the specified element in the specified sorted array.
array | the sorted Object array to search |
---|---|
object | the Object element to find |
ClassCastException | when an element in the array or the search element does not implement Comparable, or cannot be compared to each other |
---|
Performs a binary search for the specified element in the specified sorted array.
array | the sorted float array to search |
---|---|
value | the float element to find |
Performs a binary search for the specified element in a part of the specified sorted array.
array | the sorted double array to search |
---|---|
startIndex | the inclusive start index |
endIndex | the exclusive end index |
value | the double element to find |
IllegalArgumentException | - if startIndex is bigger than endIndex |
---|---|
ArrayIndexOutOfBoundsException | - if startIndex is smaller than zero or or endIndex is bigger than length of array |
Copies the specified array, truncating or padding with null characters (if necessary) so the copy has the specified length. For all indices that are valid in both the original array and the copy, the two arrays will contain identical values. For any indices that are valid in the copy but not the original, the copy will contain '\\u000'. Such indices will exist if and only if the specified length is greater than that of the original array.
original | the array to be copied |
---|---|
newLength | the length of the copy to be returned |
NegativeArraySizeException | if newLength is negative |
---|---|
NullPointerException | if original is null |
Copies elements in original array to a new array, from index start(inclusive) to end(exclusive). The first element (if any) in the new array is original[from], and other elements in the new array are in the original order. The padding value whose index is bigger than or equal to original.length - start is 0d.
original | the original array |
---|---|
start | the start index, inclusive |
end | the end index, exclusive, may bigger than length of the array |
ArrayIndexOutOfBoundsException | if start is smaller than 0 or bigger than original.length |
---|---|
IllegalArgumentException | if start is bigger than end |
NullPointerException | if original is null |
Copies elements in original array to a new array, from index start(inclusive) to end(exclusive). The first element (if any) in the new array is original[from], and other elements in the new array are in the original order. The padding value whose index is bigger than or equal to original.length - start is false.
original | the original array |
---|---|
start | the start index, inclusive |
end | the end index, exclusive, may bigger than length of the array |
ArrayIndexOutOfBoundsException | if start is smaller than 0 or bigger than original.length |
---|---|
IllegalArgumentException | if start is bigger than end |
NullPointerException | if original is null |
Copies elements in original array to a new array, from index start(inclusive) to end(exclusive). The first element (if any) in the new array is original[from], and other elements in the new array are in the original order. The padding value whose index is bigger than or equal to original.length - start is (short)0.
original | the original array |
---|---|
start | the start index, inclusive |
end | the end index, exclusive, may bigger than length of the array |
ArrayIndexOutOfBoundsException | if start is smaller than 0 or bigger than original.length |
---|---|
IllegalArgumentException | if start is bigger than end |
NullPointerException | if original is null |
Copies elements in original array to a new array, from index start(inclusive) to end(exclusive). The first element (if any) in the new array is original[from], and other elements in the new array are in the original order. The padding value whose index is bigger than or equal to original.length - start is '\\u000'.
original | the original array |
---|---|
start | the start index, inclusive |
end | the end index, exclusive, may bigger than length of the array |
ArrayIndexOutOfBoundsException | if start is smaller than 0 or bigger than original.length |
---|---|
IllegalArgumentException | if start is bigger than end |
NullPointerException | if original is null |
Copies elements in original array to a new array, from index start(inclusive) to end(exclusive). The first element (if any) in the new array is original[from], and other elements in the new array are in the original order. The padding value whose index is bigger than or equal to original.length - start is 0f.
original | the original array |
---|---|
start | the start index, inclusive |
end | the end index, exclusive, may bigger than length of the array |
ArrayIndexOutOfBoundsException | if start is smaller than 0 or bigger than original.length |
---|---|
IllegalArgumentException | if start is bigger than end |
NullPointerException | if original is null |
Copies elements in original array to a new array, from index start(inclusive) to end(exclusive). The first element (if any) in the new array is original[from], and other elements in the new array are in the original order. The padding value whose index is bigger than or equal to original.length - start is 0L.
original | the original array |
---|---|
start | the start index, inclusive |
end | the end index, exclusive, may bigger than length of the array |
ArrayIndexOutOfBoundsException | if start is smaller than 0 or bigger than original.length |
---|---|
IllegalArgumentException | if start is bigger than end |
NullPointerException | if original is null |
Copies elements in original array to a new array, from index start(inclusive) to end(exclusive). The first element (if any) in the new array is original[from], and other elements in the new array are in the original order. The padding value whose index is bigger than or equal to original.length - start is 0.
original | the original array |
---|---|
start | the start index, inclusive |
end | the end index, exclusive, may bigger than length of the array |
ArrayIndexOutOfBoundsException | if start is smaller than 0 or bigger than original.length |
---|---|
IllegalArgumentException | if start is bigger than end |
NullPointerException | if original is null |
Copies elements in original array to a new array, from index start(inclusive) to end(exclusive). The first element (if any) in the new array is original[from], and other elements in the new array are in the original order. The padding value whose index is bigger than or equal to original.length - start is (byte)0.
original | the original array |
---|---|
start | the start index, inclusive |
end | the end index, exclusive, may bigger than length of the array |
ArrayIndexOutOfBoundsException | if start is smaller than 0 or bigger than original.length |
---|---|
IllegalArgumentException | if start is bigger than end |
NullPointerException | if original is null |
Returns true
if the two given arrays are deeply equal to one another.
Unlike the method equals(Object[] array1, Object[] array2)
, this
method is appropriate for use for nested arrays of arbitrary depth.
Two array references are considered deeply equal if they are both
null
, or if they refer to arrays that have the same length and the
elements at each index in the two arrays are equal.
Two null
elements element1
and element2
are possibly
deeply equal if any of the following conditions satisfied:
element1
and element2
are both arrays of object reference
types, and Arrays.deepEquals(element1, element2)
would return
true
.
element1
and element2
are arrays of the same primitive type,
and the appropriate overloading of Arrays.equals(element1, element2)
would return true
.
element1 == element2
element1.equals(element2)
would return true
.
Note that this definition permits null
elements at any depth.
If either of the given arrays contain themselves as elements, the behavior of this method is uncertain.
array1 | the first Object array. |
---|---|
array2 | the second Object array. |
true
if both arrays are null
or if the arrays have
the same length and the elements at each index in the two arrays are
equal according to equals()
, false
otherwise.
Returns a hash code based on the "deep contents" of the given array. If the array contains other arrays as its elements, the hash code is based on their contents not their identities. So it is not acceptable to invoke this method on an array that contains itself as an element, either directly or indirectly.
For any two arrays a
and b
, if
Arrays.deepEquals(a, b)
returns true
, it means that the
return value of Arrays.deepHashCode(a)
equals
Arrays.deepHashCode(b)
.
The computation of the value returned by this method is similar to that of
the value returned by hashCode()
invoked on a List
containing a sequence of instances representing the elements of array in the
same order. The difference is: If an element e of array is itself an array,
its hash code is computed by calling the appropriate overloading of
Arrays.hashCode(e)
if e is an array of a primitive type, or by
calling Arrays.deepHashCode(e)
recursively if e is an array of a
reference type. The value returned by this method is the same value as the
method Arrays.asList(array).hashCode()
. If the array is null
,
the return value is 0.
array | the array whose hash code to compute. |
---|
array
.
Creates a "deep" String
representation of the Object[]
passed, such that if the array contains other arrays, the String
representation of those arrays is generated as well.
If any of the elements are primitive arrays, the generation is delegated to
the other toString
methods in this class. If any element contains a
reference to the original array, then it will be represented as
"[...]"
. If an element is an Object[]
, then its
representation is generated by a recursive call to this method. All other
elements are converted via the valueOf(Object)
method.
array | the Object array to convert. |
---|
String
representation of array
.Compares the two arrays.
array1 | the first Object array. |
---|---|
array2 | the second Object array. |
true
if both arrays are null
or if the arrays have
the same length and the elements at each index in the two arrays are
equal according to equals()
, false
otherwise.
Compares the two arrays. The values are compared in the same manner as
Double.equals()
.
array1 | the first double array. |
---|---|
array2 | the second double array. |
true
if both arrays are null
or if the arrays have
the same length and the elements at each index in the two arrays are
equal, false
otherwise.Compares the two arrays.
array1 | the first long array. |
---|---|
array2 | the second long array. |
true
if both arrays are null
or if the arrays have
the same length and the elements at each index in the two arrays are
equal, false
otherwise.
Compares the two arrays. The values are compared in the same manner as
Float.equals()
.
array1 | the first float array. |
---|---|
array2 | the second float array. |
true
if both arrays are null
or if the arrays have
the same length and the elements at each index in the two arrays are
equal, false
otherwise.Compares the two arrays.
array1 | the first short array. |
---|---|
array2 | the second short array. |
true
if both arrays are null
or if the arrays have
the same length and the elements at each index in the two arrays are
equal, false
otherwise.
Compares the two arrays.
array1 | the first byte array. |
---|---|
array2 | the second byte array. |
true
if both arrays are null
or if the arrays have
the same length and the elements at each index in the two arrays are
equal, false
otherwise.
Compares the two arrays.
array1 | the first char array. |
---|---|
array2 | the second char array. |
true
if both arrays are null
or if the arrays have
the same length and the elements at each index in the two arrays are
equal, false
otherwise.
Compares the two arrays.
array1 | the first boolean array. |
---|---|
array2 | the second boolean array. |
true
if both arrays are null
or if the arrays have
the same length and the elements at each index in the two arrays are
equal, false
otherwise.
Compares the two arrays.
array1 | the first int array. |
---|---|
array2 | the second int array. |
true
if both arrays are null
or if the arrays have
the same length and the elements at each index in the two arrays are
equal, false
otherwise.
Fills the specified range in the array with the specified element.
array | the float array to fill. |
---|---|
start | the first index to fill. |
end | the last + 1 index to fill. |
value | the float element. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Fills the specified array with the specified element.
array | the long array to fill. |
---|---|
value | the long element.
|
Fills the specified array with the specified element.
array | the float array to fill. |
---|---|
value | the float element.
|
Fills the specified range in the array with the specified element.
array | the long array to fill. |
---|---|
start | the first index to fill. |
end | the last + 1 index to fill. |
value | the long element. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Fills the specified array with the specified element.
array | the byte array to fill. |
---|---|
value | the byte element.
|
Fills the specified range in the array with the specified element.
array | the byte array to fill. |
---|---|
start | the first index to fill. |
end | the last + 1 index to fill. |
value | the byte element. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Fills the specified array with the specified element.
array | the char array to fill. |
---|---|
value | the char element.
|
Fills the specified range in the array with the specified element.
array | the int array to fill. |
---|---|
start | the first index to fill. |
end | the last + 1 index to fill. |
value | the int element. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Fills the specified range in the array with the specified element.
array | the double array to fill. |
---|---|
start | the first index to fill. |
end | the last + 1 index to fill. |
value | the double element. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Fills the specified range in the array with the specified element.
array | the boolean array to fill. |
---|---|
start | the first index to fill. |
end | the last + 1 index to fill. |
value | the boolean element. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Fills the specified range in the array with the specified element.
array | the short array to fill. |
---|---|
start | the first index to fill. |
end | the last + 1 index to fill. |
value | the short element. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Fills the specified range in the array with the specified element.
array | the char array to fill. |
---|---|
start | the first index to fill. |
end | the last + 1 index to fill. |
value | the char element. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Fills the specified array with the specified element.
array | the boolean array to fill. |
---|---|
value | the boolean element.
|
Fills the specified array with the specified element.
array | the short array to fill. |
---|---|
value | the short element.
|
Fills the specified array with the specified element.
array | the Object array to fill. |
---|---|
value | the Object element.
|
Fills the specified range in the array with the specified element.
array | the Object array to fill. |
---|---|
start | the first index to fill. |
end | the last + 1 index to fill. |
value | the Object element. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Fills the specified array with the specified element.
array | the double array to fill. |
---|---|
value | the double element.
|
Fills the specified array with the specified element.
array | the int array to fill. |
---|---|
value | the int element.
|
Returns a hash code based on the contents of the given array. For any two
byte
arrays a
and b
, if Arrays.equals(a, b)
returns true
, it means that the return value of
Arrays.hashCode(a)
equals Arrays.hashCode(b)
.
The value returned by this method is the same value as the
hashCode()
method which is invoked on a List
containing
a sequence of Byte
instances representing the elements of array in
the same order. If the array is null
, the return value is 0.
array | the array whose hash code to compute. |
---|
array
.
Returns a hash code based on the contents of the given array. For any two
not-null int
arrays a
and b
, if
Arrays.equals(a, b)
returns true
, it means that the return
value of Arrays.hashCode(a)
equals Arrays.hashCode(b)
.
The value returned by this method is the same value as the
hashCode()
method which is invoked on a List
containing
a sequence of Integer
instances representing the elements of array in
the same order. If the array is null
, the return value is 0.
array | the array whose hash code to compute. |
---|
array
.
Returns a hash code based on the contents of the given array. For any two
float
arrays a
and b
, if Arrays.equals(a, b)
returns true
, it means that the return value of
Arrays.hashCode(a)
equals Arrays.hashCode(b)
.
The value returned by this method is the same value as the
hashCode()
method which is invoked on a List
containing
a sequence of Float
instances representing the elements of array in
the same order. If the array is null
, the return value is 0.
array | the array whose hash code to compute. |
---|
array
.
Returns a hash code based on the contents of the given array. For any two
boolean
arrays a
and b
, if
Arrays.equals(a, b)
returns true
, it means that the return
value of Arrays.hashCode(a)
equals Arrays.hashCode(b)
.
The value returned by this method is the same value as the
hashCode()
method which is invoked on a List
containing
a sequence of Boolean
instances representing the elements of array in
the same order. If the array is null
, the return value is 0.
array | the array whose hash code to compute. |
---|
array
.
Returns a hash code based on the contents of the given array. For any two
short
arrays a
and b
, if Arrays.equals(a, b)
returns true
, it means that the return value of
Arrays.hashCode(a)
equals Arrays.hashCode(b)
.
The value returned by this method is the same value as the
hashCode()
method which is invoked on a List
containing
a sequence of Short
instances representing the elements of array in
the same order. If the array is null
, the return value is 0.
array | the array whose hash code to compute. |
---|
array
.
Returns a hash code based on the contents of the given array. For any two
char
arrays a
and b
, if Arrays.equals(a, b)
returns true
, it means that the return value of
Arrays.hashCode(a)
equals Arrays.hashCode(b)
.
The value returned by this method is the same value as the
hashCode()
method which is invoked on a List
containing
a sequence of Character
instances representing the elements of array
in the same order. If the array is null
, the return value is 0.
array | the array whose hash code to compute. |
---|
array
.
Returns a hash code based on the contents of the given array. If the array contains other arrays as its elements, the hash code is based on their identities not their contents. So it is acceptable to invoke this method on an array that contains itself as an element, either directly or indirectly.
For any two arrays a
and b
, if Arrays.equals(a, b)
returns true
, it means that the return value of
Arrays.hashCode(a)
equals Arrays.hashCode(b)
.
The value returned by this method is the same value as the method
Arrays.asList(array).hashCode(). If the array is null
, the return
value is 0.
array | the array whose hash code to compute. |
---|
array
.
Returns a hash code based on the contents of the given array. For any two
long
arrays a
and b
, if Arrays.equals(a, b)
returns true
, it means that the return value of
Arrays.hashCode(a)
equals Arrays.hashCode(b)
.
The value returned by this method is the same value as the
hashCode()
method which is invoked on a List
containing
a sequence of Long
instances representing the elements of array in
the same order. If the array is null
, the return value is 0.
array | the array whose hash code to compute. |
---|
array
.
Returns a hash code based on the contents of the given array. For any two
double
arrays a
and b
, if Arrays.equals(a, b)
returns true
, it means that the return value of
Arrays.hashCode(a)
equals Arrays.hashCode(b)
.
The value returned by this method is the same value as the
hashCode()
method which is invoked on a List
containing
a sequence of Double
instances representing the elements of array in
the same order. If the array is null
, the return value is 0.
array | the array whose hash code to compute. |
---|
array
.
Sorts the specified array in ascending numerical order.
array | the int array to be sorted.
|
---|
Sorts the specified range in the array in ascending natural order. All
elements must implement the Comparable
interface and must be
comparable to each other without a ClassCastException
being thrown.
array | the Object array to be sorted. |
---|---|
start | the start index to sort. |
end | the last + 1 index to sort. |
ClassCastException | if an element in the array does not implement Comparable
or some elements cannot be compared to each other. |
---|---|
IllegalArgumentException | if start > end . |
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Sorts the specified range in the array in ascending numerical order.
array | the long array to be sorted. |
---|---|
start | the start index to sort. |
end | the last + 1 index to sort. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Sorts the specified array in ascending numerical order.
array | the char array to be sorted.
|
---|
Sorts the specified range in the array in ascending numerical order. The
values are sorted according to the order imposed by
Double.compareTo()
.
array | the double array to be sorted. |
---|---|
start | the start index to sort. |
end | the last + 1 index to sort. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length . |
Sorts the specified array in ascending numerical order.
array | the double array to be sorted. |
---|
Sorts the specified array in ascending natural order.
array | the Object array to be sorted. |
---|
ClassCastException | if an element in the array does not implement Comparable
or if some elements cannot be compared to each other. |
---|
Sorts the specified array in ascending numerical order.
array | the short array to be sorted.
|
---|
Sorts the specified range in the array in ascending numerical order.
array | the char array to be sorted. |
---|---|
start | the start index to sort. |
end | the last + 1 index to sort. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Sorts the specified array in ascending numerical order.
array | the long array to be sorted.
|
---|
Sorts the specified range in the array in ascending numerical order.
array | the int array to be sorted. |
---|---|
start | the start index to sort. |
end | the last + 1 index to sort. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Sorts the specified range in the array in ascending numerical order.
array | the byte array to be sorted. |
---|---|
start | the start index to sort. |
end | the last + 1 index to sort. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Sorts the specified range in the array using the specified
Comparator
. All elements must be comparable to each other without a
ClassCastException
being thrown.
array | the Object array to be sorted. |
---|---|
start | the start index to sort. |
end | the last + 1 index to sort. |
comparator | the Comparator . |
ClassCastException | if elements in the array cannot be compared to each other using
the Comparator . |
---|---|
IllegalArgumentException | if start > end . |
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Sorts the specified range in the array in ascending numerical order. The
values are sorted according to the order imposed by
Float.compareTo()
.
array | the float array to be sorted. |
---|---|
start | the start index to sort. |
end | the last + 1 index to sort. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length . |
Sorts the specified range in the array in ascending numerical order.
array | the short array to be sorted. |
---|---|
start | the start index to sort. |
end | the last + 1 index to sort. |
IllegalArgumentException | if start > end . |
---|---|
ArrayIndexOutOfBoundsException | if start < 0 or end > array.length .
|
Sorts the specified array in ascending numerical order.
array | the float array to be sorted. |
---|
Sorts the specified array using the specified Comparator
. All
elements must be comparable to each other without a
ClassCastException
being thrown.
array | the Object array to be sorted. |
---|---|
comparator | the Comparator . |
ClassCastException | if elements in the array cannot be compared to each other using
the Comparator .
|
---|
Sorts the specified array in ascending numerical order.
array | the byte array to be sorted.
|
---|
Creates a String
representation of the float[]
passed. The
result is surrounded by brackets ("[]"
), each element is
converted to a String
via the valueOf(float)
and
separated by ", "
. If the array is null
, then
"null"
is returned.
array | the float array to convert. |
---|
String
representation of array
.Creates a String
representation of the int[]
passed. The
result is surrounded by brackets ("[]"
), each element is
converted to a String
via the valueOf(int)
and
separated by ", "
. If the array is null
, then
"null"
is returned.
array | the int array to convert. |
---|
String
representation of array
.Creates a String
representation of the char[]
passed. The
result is surrounded by brackets ("[]"
), each element is
converted to a String
via the valueOf(char)
and
separated by ", "
. If the array is null
, then
"null"
is returned.
array | the char array to convert. |
---|
String
representation of array
.Creates a String
representation of the Object[]
passed. The
result is surrounded by brackets ("[]"
), each element is
converted to a String
via the valueOf(Object)
and
separated by ", "
. If the array is null
, then
"null"
is returned.
array | the Object array to convert. |
---|
String
representation of array
.Creates a String
representation of the byte[]
passed. The
result is surrounded by brackets ("[]"
), each element is
converted to a String
via the valueOf(int)
and
separated by ", "
. If the array is null
, then
"null"
is returned.
array | the byte array to convert. |
---|
String
representation of array
.Creates a String
representation of the long[]
passed. The
result is surrounded by brackets ("[]"
), each element is
converted to a String
via the valueOf(long)
and
separated by ", "
. If the array is null
, then
"null"
is returned.
array | the long array to convert. |
---|
String
representation of array
.Creates a String
representation of the boolean[]
passed. The
result is surrounded by brackets ("[]"
), each element is
converted to a String
via the valueOf(boolean)
and
separated by ", "
. If the array is null
, then
"null"
is returned.
array | the boolean array to convert. |
---|
String
representation of array
.Creates a String
representation of the double[]
passed. The
result is surrounded by brackets ("[]"
), each element is
converted to a String
via the valueOf(double)
and
separated by ", "
. If the array is null
, then
"null"
is returned.
array | the double array to convert. |
---|
String
representation of array
.Creates a String
representation of the short[]
passed. The
result is surrounded by brackets ("[]"
), each element is
converted to a String
via the valueOf(int)
and
separated by ", "
. If the array is null
, then
"null"
is returned.
array | the short array to convert. |
---|
String
representation of array
.