|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.Arrays
public class Arrays
Arrays contains static methods which operate on arrays.
| Method Summary | ||
|---|---|---|
static
|
asList(T... array)
Returns a List on the objects in the specified array. |
|
static int |
binarySearch(byte[] array,
byte value)
Performs a binary search for the specified element in 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(double[] array,
double value)
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(int[] array,
int value)
Performs a binary search for the specified element in 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 int |
binarySearch(Object[] array,
Object object)
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
|
binarySearch(T[] array,
T 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 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(boolean[] array1,
boolean[] 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(double[] array1,
double[] array2)
Compares the two arrays. |
|
static boolean |
equals(float[] array1,
float[] array2)
Compares the two arrays. |
|
static boolean |
equals(int[] array1,
int[] array2)
Compares the two arrays. |
|
static boolean |
equals(long[] array1,
long[] array2)
Compares the two arrays. |
|
static boolean |
equals(Object[] array1,
Object[] array2)
Compares the two arrays. |
|
static boolean |
equals(short[] array1,
short[] array2)
Compares the two arrays. |
|
static void |
fill(boolean[] array,
boolean value)
Fills the specified 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(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(char[] array,
int start,
int end,
char 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(double[] array,
int start,
int end,
double value)
Fills the specified range in the array with the specified element. |
|
static void |
fill(float[] array,
float value)
Fills the specified array with the specified element. |
|
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(int[] array,
int 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(long[] array,
int start,
int end,
long 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(Object[] array,
int start,
int end,
Object value)
Fills the specified range in the array with the specified element. |
|
static void |
fill(Object[] array,
Object value)
Fills the specified 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(short[] array,
short value)
Fills the specified array with the specified element. |
|
static int |
hashCode(boolean[] array)
Returns a hash code based on the contents of the given array. |
|
static int |
hashCode(byte[] 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(double[] 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(int[] 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(Object[] 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 void |
sort(byte[] array)
Sorts the specified array in ascending order. |
|
static void |
sort(byte[] array,
int start,
int end)
Sorts the specified range in the array in ascending order. |
|
static void |
sort(char[] array)
Sorts the specified array in ascending order. |
|
static void |
sort(char[] array,
int start,
int end)
Sorts the specified range in the array in ascending order. |
|
static void |
sort(double[] array)
Sorts the specified array in ascending order. |
|
static void |
sort(double[] array,
int start,
int end)
Sorts the specified range in the array in ascending order. |
|
static void |
sort(float[] array)
Sorts the specified array in ascending order. |
|
static void |
sort(float[] array,
int start,
int end)
Sorts the specified range in the array in ascending order. |
|
static void |
sort(int[] array)
Sorts the specified array in ascending order. |
|
static void |
sort(int[] array,
int start,
int end)
Sorts the specified range in the array in ascending order. |
|
static void |
sort(long[] array)
Sorts the specified array in ascending order. |
|
static void |
sort(long[] array,
int start,
int end)
Sorts the specified range in the array in ascending order. |
|
static void |
sort(Object[] array)
Sorts the specified array in ascending order. |
|
static void |
sort(Object[] array,
int start,
int end)
Sorts the specified range in the array in ascending order. |
|
static void |
sort(short[] array)
Sorts the specified array in ascending order. |
|
static void |
sort(short[] array,
int start,
int end)
Sorts the specified range in the array in ascending order. |
|
static
|
sort(T[] array,
Comparator<? super T> comparator)
Sorts the specified array using the specified Comparator. |
|
static
|
sort(T[] array,
int start,
int end,
Comparator<? super T> comparator)
Sorts the specified range in the array using the specified Comparator. |
|
static String |
toString(boolean[] array)
Creates a String representation of the
boolean[] passed. |
|
static String |
toString(byte[] array)
Creates a String representation of the byte[]
passed. |
|
static String |
toString(char[] array)
Creates a String representation of the char[]
passed. |
|
static String |
toString(double[] array)
Creates a String representation of the
double[] passed. |
|
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(long[] array)
Creates a String representation of the long[]
passed. |
|
static String |
toString(Object[] array)
Creates a String representation of the
Object[] passed. |
|
static String |
toString(short[] array)
Creates a String representation of the
short[] passed. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> List<T> asList(T... array)
array - the array
public static int binarySearch(byte[] array,
byte value)
array - the sorted byte array to searchvalue - the byte element to find
public static int binarySearch(char[] array,
char value)
array - the sorted char array to searchvalue - the char element to find
public static int binarySearch(double[] array,
double value)
array - the sorted double array to searchvalue - the double element to find
public static int binarySearch(float[] array,
float value)
array - the sorted float array to searchvalue - the float element to find
public static int binarySearch(int[] array,
int value)
array - the sorted int array to searchvalue - the int element to find
public static int binarySearch(long[] array,
long value)
array - the sorted long array to searchvalue - the long element to find
public static int binarySearch(Object[] array,
Object object)
array - the sorted Object array to searchobject - 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
public static <T> int binarySearch(T[] array,
T object,
Comparator<? super T> comparator)
array - the sorted char array to searchobject - the char element to findcomparator - the Comparator
ClassCastException - when an element in the array and the search element cannot
be compared to each other using the Comparator
public static int binarySearch(short[] array,
short value)
array - the sorted short array to searchvalue - the short element to find
public static void fill(byte[] array,
byte value)
array - the byte array to fillvalue - the byte element
public static void fill(byte[] array,
int start,
int end,
byte value)
array - the byte array to fillstart - the first index to fillend - the last + 1 index to fillvalue - the byte element
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()
public static void fill(short[] array,
short value)
array - the short array to fillvalue - the short element
public static void fill(short[] array,
int start,
int end,
short value)
array - the short array to fillstart - the first index to fillend - the last + 1 index to fillvalue - the short element
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()
public static void fill(char[] array,
char value)
array - the char array to fillvalue - the char element
public static void fill(char[] array,
int start,
int end,
char value)
array - the char array to fillstart - the first index to fillend - the last + 1 index to fillvalue - the char element
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()
public static void fill(int[] array,
int value)
array - the int array to fillvalue - the int element
public static void fill(int[] array,
int start,
int end,
int value)
array - the int array to fillstart - the first index to fillend - the last + 1 index to fillvalue - the int element
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()
public static void fill(long[] array,
long value)
array - the long array to fillvalue - the long element
public static void fill(long[] array,
int start,
int end,
long value)
array - the long array to fillstart - the first index to fillend - the last + 1 index to fillvalue - the long element
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()
public static void fill(float[] array,
float value)
array - the float array to fillvalue - the float element
public static void fill(float[] array,
int start,
int end,
float value)
array - the float array to fillstart - the first index to fillend - the last + 1 index to fillvalue - the float element
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()
public static void fill(double[] array,
double value)
array - the float array to fillvalue - the float element
public static void fill(double[] array,
int start,
int end,
double value)
array - the double array to fillstart - the first index to fillend - the last + 1 index to fillvalue - the double element
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()
public static void fill(boolean[] array,
boolean value)
array - the boolean array to fillvalue - the boolean element
public static void fill(boolean[] array,
int start,
int end,
boolean value)
array - the boolean array to fillstart - the first index to fillend - the last + 1 index to fillvalue - the boolean element
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()
public static void fill(Object[] array,
Object value)
array - the Object array to fillvalue - the Object element
public static void fill(Object[] array,
int start,
int end,
Object value)
array - the Object array to fillstart - the first index to fillend - the last + 1 index to fillvalue - the Object element
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()public static int hashCode(boolean[] array)
List.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
public static int hashCode(int[] array)
List.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
public static int hashCode(short[] array)
List.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
public static int hashCode(char[] array)
List.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
public static int hashCode(byte[] array)
List.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
public static int hashCode(long[] array)
List.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
public static int hashCode(float[] array)
List.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
public static int hashCode(double[] array)
List.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
public static int hashCode(Object[] array)
array - the array whose hash code to compute
public static int deepHashCode(Object[] array)
List.hashCode()} method 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
public static boolean equals(byte[] array1,
byte[] array2)
array1 - the first byte arrayarray2 - the second byte array
public static boolean equals(short[] array1,
short[] array2)
array1 - the first short arrayarray2 - the second short array
public static boolean equals(char[] array1,
char[] array2)
array1 - the first char arrayarray2 - the second char array
public static boolean equals(int[] array1,
int[] array2)
array1 - the first int arrayarray2 - the second int array
public static boolean equals(long[] array1,
long[] array2)
array1 - the first long arrayarray2 - the second long array
public static boolean equals(float[] array1,
float[] array2)
array1 - the first float arrayarray2 - the second float array
Float.equals(Object)
public static boolean equals(double[] array1,
double[] array2)
array1 - the first double arrayarray2 - the second double array
Double.equals(Object)
public static boolean equals(boolean[] array1,
boolean[] array2)
array1 - the first boolean arrayarray2 - the second boolean array
public static boolean equals(Object[] array1,
Object[] array2)
array1 - the first Object arrayarray2 - the second Object array
public static boolean deepEquals(Object[] array1,
Object[] array2)
array1 - the first Object arrayarray2 - the second Object array
public static void sort(byte[] array)
array - the byte array to be sorted
public static void sort(byte[] array,
int start,
int end)
array - the byte array to be sortedstart - the start index to sortend - the last + 1 index to sort
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()public static void sort(char[] array)
array - the char array to be sorted
public static void sort(char[] array,
int start,
int end)
array - the char array to be sortedstart - the start index to sortend - the last + 1 index to sort
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()public static void sort(double[] array)
array - the double array to be sortedsort(double[], int, int)
public static void sort(double[] array,
int start,
int end)
array - the double array to be sortedstart - the start index to sortend - the last + 1 index to sort
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()Double.compareTo(Double)public static void sort(float[] array)
array - the float array to be sortedsort(float[], int, int)
public static void sort(float[] array,
int start,
int end)
array - the float array to be sortedstart - the start index to sortend - the last + 1 index to sort
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()Float.compareTo(Float)public static void sort(int[] array)
array - the int array to be sorted
public static void sort(int[] array,
int start,
int end)
array - the int array to be sortedstart - the start index to sortend - the last + 1 index to sort
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()public static void sort(long[] array)
array - the long array to be sorted
public static void sort(long[] array,
int start,
int end)
array - the long array to be sortedstart - the start index to sortend - the last + 1 index to sort
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()public static void sort(Object[] array)
array - the Object array to be sorted
ClassCastException - when an element in the array does not implement Comparable
or elements cannot be compared to each other
public static void sort(Object[] array,
int start,
int end)
array - the Object array to be sortedstart - the start index to sortend - the last + 1 index to sort
ClassCastException - when an element in the array does not implement Comparable
or elements cannot be compared to each other
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()
public static <T> void sort(T[] array,
int start,
int end,
Comparator<? super T> comparator)
array - the Object array to be sortedstart - the start index to sortend - the last + 1 index to sortcomparator - the Comparator
ClassCastException - when elements in the array cannot be compared to each
other using the Comparator
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()
public static <T> void sort(T[] array,
Comparator<? super T> comparator)
array - the Object array to be sortedcomparator - the Comparator
ClassCastException - when elements in the array cannot be compared to each
other using the Comparatorpublic static void sort(short[] array)
array - the short array to be sorted
public static void sort(short[] array,
int start,
int end)
array - the short array to be sortedstart - the start index to sortend - the last + 1 index to sort
IllegalArgumentException - when start > end
ArrayIndexOutOfBoundsException - when start < 0 or
end > array.size()public static String toString(boolean[] array)
Creates a String representation of the
boolean[] passed. The result is surrounded by brackets ("[]"),
each element is converted to a String via the
String.valueOf(boolean) and separated by
", ". If the array is null,
then "null" is returned.
array - The boolean array to convert.
String representation of array.public static String toString(byte[] array)
Creates a String representation of the byte[]
passed. The result is surrounded by brackets ("[]"),
each element is converted to a String via the
String.valueOf(int) and separated by ", ".
If the array is null, then "null"
is returned.
array - The byte array to convert.
String representation of array.public static String toString(char[] array)
Creates a String representation of the char[]
passed. The result is surrounded by brackets ("[]"),
each element is converted to a String via the
String.valueOf(char) and separated by ", ".
If the array is null, then "null"
is returned.
array - The char array to convert.
String representation of array.public static String toString(double[] array)
Creates a String representation of the
double[] passed. The result is surrounded by brackets ("[]"),
each element is converted to a String via the
String.valueOf(double) and separated by
", ". If the array is null,
then "null" is returned.
array - The double array to convert.
String representation of array.public static String toString(float[] array)
Creates a String representation of the
float[] passed. The result is surrounded by brackets ("[]"),
each element is converted to a String via the
String.valueOf(float) and separated by
", ". If the array is null,
then "null" is returned.
array - The float array to convert.
String representation of array.public static String toString(int[] array)
Creates a String representation of the int[]
passed. The result is surrounded by brackets ("[]"),
each element is converted to a String via the
String.valueOf(int) and separated by ", ".
If the array is null, then "null"
is returned.
array - The int array to convert.
String representation of array.public static String toString(long[] array)
Creates a String representation of the long[]
passed. The result is surrounded by brackets ("[]"),
each element is converted to a String via the
String.valueOf(long) and separated by ", ".
If the array is null, then "null"
is returned.
array - The long array to convert.
String representation of array.public static String toString(short[] array)
Creates a String representation of the
short[] passed. The result is surrounded by brackets ("[]"),
each element is converted to a String via the
String.valueOf(int) and separated by
", ". If the array is null,
then "null" is returned.
array - The short array to convert.
String representation of array.public static String toString(Object[] array)
Creates a String representation of the
Object[] passed. The result is surrounded by brackets ("[]"),
each element is converted to a String via the
String.valueOf(Object) and separated by
", ". If the array is null,
then "null" is returned.
array - The Object array to convert.
String representation of array.public 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.
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
String.valueOf(Object) method.
array - The Object array to convert.
String representation of array.
|
Build 1.0_r1(from source) | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||