Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class java.util.Arrays

java.lang.Object
  |
  +--java.util.Arrays

public class Arrays
extends java.lang.Object
This class contains various methods for manipulating arrays (such as sorting and searching). It also contains a static factory that allows arrays to be viewed as Lists.

Since:
JDK1.2
Version:
1.22 05/05/98
See Also:
java.lang.Comparable, Comparator

Method Summary
static List asList(java.lang.Object[] a)
          Returns a fixed-size List backed by the specified array.
static int binarySearch(long[] a, long key)
          Searches the specified array of longs for the specified value using the binary search algorithm.
static int binarySearch(int[] a, int key)
          Searches the specified array of ints for the specified value using the binary search algorithm.
static int binarySearch(short[] a, short key)
          Searches the specified array of shorts for the specified value using the binary search algorithm.
static int binarySearch(char[] a, char key)
          Searches the specified array of chars for the specified value using the binary search algorithm.
static int binarySearch(byte[] a, byte key)
          Searches the specified array of bytes for the specified value using the binary search algorithm.
static int binarySearch(double[] a, double key)
          Searches the specified array of doubles for the specified value using the binary search algorithm.
static int binarySearch(float[] a, float key)
          Searches the specified array of floats for the specified value using the binary search algorithm.
static int binarySearch(java.lang.Object[] a, java.lang.Object key)
          Searches the specified array for the specified Object using the binary search algorithm.
static int binarySearch(java.lang.Object[] a, java.lang.Object key, Comparator c)
          Searches the specified array for the specified Object using the binary search algorithm.
static boolean equals(long[] a, long[] a2)
          Returns true if the the two specified arrays of longs are equal to one another.
static boolean equals(int[] a, int[] a2)
          Returns true if the the two specified arrays of ints are equal to one another.
static boolean equals(short[] a, short[] a2)
          Returns true if the the two specified arrays of shorts are equal to one another.
static boolean equals(char[] a, char[] a2)
          Returns true if the the two specified arrays of chars are equal to one another.
static boolean equals(byte[] a, byte[] a2)
          Returns true if the the two specified arrays of bytes are equal to one another.
static boolean equals(boolean[] a, boolean[] a2)
          Returns true if the the two specified arrays of booleans are equal to one another.
static boolean equals(double[] a, double[] a2)
          Returns true if the the two specified arrays of doubles are equal to one another.
static boolean equals(float[] a, float[] a2)
          Returns true if the the two specified arrays of floats are equal to one another.
static boolean equals(java.lang.Object[] a, java.lang.Object[] a2)
          Returns true if the the two specified arrays of Objects are equal to one another.
static void fill(long[] a, long val)
          Sets each element of the specified array of longs with the specified long value.
static void fill(long[] a, int fromIndex, int toIndex, long val)
          Sets the specified range of elements in the specified array of longs with the specified long value.
static void fill(int[] a, int val)
          Sets each element of the specified array of ints with the specified int value.
static void fill(int[] a, int fromIndex, int toIndex, int val)
          Sets the specified range of elements in the specified array of ints with the specified int value.
static void fill(short[] a, short val)
          Sets each element of the specified array of shorts with the specified short value.
static void fill(short[] a, int fromIndex, int toIndex, short val)
          Sets the specified range of elements in the specified array of shorts with the specified short value.
static void fill(char[] a, char val)
          Sets each element of the specified array of chars with the specified char value.
static void fill(char[] a, int fromIndex, int toIndex, char val)
          Sets the specified range of elements in the specified array of chars with the specified char value.
static void fill(byte[] a, byte val)
          Sets each element of the specified array of bytes with the specified byte value.
static void fill(byte[] a, int fromIndex, int toIndex, byte val)
          Sets the specified range of elements in the specified array of bytes with the specified byte value.
static void fill(boolean[] a, boolean val)
          Sets each element of the specified array of booleans with the specified boolean value.
static void fill(boolean[] a, int fromIndex, int toIndex, boolean val)
          Sets the specified range of elements in the specified array of booleans with the specified boolean value.
static void fill(double[] a, double val)
          Sets each element of the specified array of doubles with the specified double value.
static void fill(double[] a, int fromIndex, int toIndex, double val)
          Sets the specified range of elements in the specified array of doubles with the specified double value.
static void fill(float[] a, float val)
          Sets each element of the specified array of floats with the specified float value.
static void fill(float[] a, int fromIndex, int toIndex, float val)
          Sets the specified range of elements in the specified array of floats with the specified float value.
static void fill(java.lang.Object[] a, java.lang.Object val)
          Sets each element of the specified array of Objects with the specified Object value.
static void fill(java.lang.Object[] a, int fromIndex, int toIndex, java.lang.Object val)
          Sets the specified range of elements in the specified array of Objectss with the specified Objects value.
static void sort(long[] a)
          Sorts the specified array of longs into ascending numerical order.
static void sort(int[] a)
          Sorts the specified array of ints into ascending numerical order.
static void sort(short[] a)
          Sorts the specified array of shorts into ascending numerical order.
static void sort(char[] a)
          Sorts the specified array of chars into ascending numerical order.
static void sort(byte[] a)
          Sorts the specified array of bytes into ascending numerical order.
static void sort(double[] a)
          Sorts the specified array of doubles into ascending numerical order.
static void sort(float[] a)
          Sorts the specified array of floats into ascending numerical order.
static void sort(java.lang.Object[] a)
          Sorts the specified array of objects into ascending order, according to the natural ordering of its elements.
static void sort(java.lang.Object[] a, Comparator c)
          Sorts the specified array of objects according to the order induced by the specified Comparator.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Method Detail

sort

public static void sort(long[] a)
Sorts the specified array of longs into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.
Parameters:
a - the array to be sorted.

sort

public static void sort(int[] a)
Sorts the specified array of ints into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.
Parameters:
a - the array to be sorted.

sort

public static void sort(short[] a)
Sorts the specified array of shorts into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.
Parameters:
a - the array to be sorted.

sort

public static void sort(char[] a)
Sorts the specified array of chars into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.
Parameters:
a - the array to be sorted.

sort

public static void sort(byte[] a)
Sorts the specified array of bytes into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.
Parameters:
a - the array to be sorted.

sort

public static void sort(double[] a)
Sorts the specified array of doubles into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.
Parameters:
a - the array to be sorted.

sort

public static void sort(float[] a)
Sorts the specified array of floats into ascending numerical order. The sorting algorithm is a tuned quicksort, adapted from Jon L. Bentley and M. Douglas McIlroy's "Engineering a Sort Function", Software-Practice and Experience, Vol. 23(11) P. 1249-1265 (November 1993). This algorithm offers n*log(n) performance on many data sets that cause other quicksorts to degrade to quadratic performance.
Parameters:
a - the array to be sorted.

sort

public static void sort(java.lang.Object[] a)
Sorts the specified array of objects into ascending order, according to the natural ordering of its elements. All elements in the array must implement the Comparable interface. Furthermore, all elements in the array must be mutually comparable (that is, e1.compareTo(e2) must not throw a typeMismatchException for any elements e1 and e2 in the array).

This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.

The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance, and can approach linear performance on nearly sorted lists.

Parameters:
a - the array to be sorted.
Throws:
ClassCastException - array contains elements that are not mutually comparable (for example, Strings and Integers).
See Also:
java.lang.Comparable


sort

public static void sort(java.lang.Object[] a,
                        Comparator c)
Sorts the specified array of objects according to the order induced by the specified Comparator. All elements in the array must be mutually comparable by the specified comparator (that is, comparator.compare(e1, e2) must not throw a typeMismatchException for any elements e1 and e2 in the array).

This sort is guaranteed to be stable: equal elements will not be reordered as a result of the sort.

The sorting algorithm is a modified mergesort (in which the merge is omitted if the highest element in the low sublist is less than the lowest element in the high sublist). This algorithm offers guaranteed n*log(n) performance, and can approach linear performance on nearly sorted lists.

Parameters:
a - the array to be sorted.
c - the Comparator to determine the order of the array.
Throws:
ClassCastException - array contains elements that are not mutually comparable with the specified Comparator.
See Also:
Comparator


binarySearch

public static int binarySearch(long[] a,
                               long key)
Searches the specified array of longs for the specified value using the binary search algorithm. The array must must be sorted (as by the sort method, above) prior to making this call. If it is not sorted, the results are undefined: in particular, the call may enter an infinite loop. If the array contains multiple elements equal to the specified object, there is no guarantee which instance will be found.
Parameters:
a - the array to be searched.
key - the value to be searched for.
Returns:
index of the search key, if it is contained in the array; otherwise, (-(insertion point) - 1). The insertion point is defined as the the point at which the value would be inserted into the array: the index of the first element greater than the value, or a.length, if all elements in the array are less than the specified value. Note that this guarantees that the return value will be >= 0 if and only if the object is found.
See Also:
sort(long[])

binarySearch

public static int binarySearch(int[] a,
                               int key)
Searches the specified array of ints for the specified value using the binary search algorithm. The array must must be sorted (as by the sort method, above) prior to making this call. If it is not sorted, the results are undefined: in particular, the call may enter an infinite loop. If the array contains multiple elements equal to the specified object, there is no guarantee which instance will be found.
Parameters:
a - the array to be searched.
key - the value to be searched for.
Returns:
index of the search key, if it is contained in the array; otherwise, (-(the "insertion point") - 1).
See Also:
sort(int[])

binarySearch

public static int binarySearch(short[] a,
                               short key)
Searches the specified array of shorts for the specified value using the binary search algorithm. The array must must be sorted (as by the sort method, above) prior to making this call. If it is not sorted, the results are undefined: in particular, the call may enter an infinite loop. If the array contains multiple elements equal to the specified object, there is no guarantee which instance will be found.
Parameters:
a - the array to be searched.
key - the value to be searched for.
Returns:
index of the search key, if it is contained in the array; otherwise, (-(the "insertion point") - 1).
See Also:
sort(short[])

binarySearch

public static int binarySearch(char[] a,
                               char key)
Searches the specified array of chars for the specified value using the binary search algorithm. The array must must be sorted (as by the sort method, above) prior to making this call. If it is not sorted, the results are undefined: in particular, the call may enter an infinite loop. If the array contains multiple elements equal to the specified object, there is no guarantee which instance will be found.
Parameters:
a - the array to be searched.
key - the value to be searched for.
Returns:
index of the search key, if it is contained in the array; otherwise, (-(the "insertion point") - 1).
See Also:
sort(char[])

binarySearch

public static int binarySearch(byte[] a,
                               byte key)
Searches the specified array of bytes for the specified value using the binary search algorithm. The array must must be sorted (as by the sort method, above) prior to making this call. If it is not sorted, the results are undefined: in particular, the call may enter an infinite loop. If the array contains multiple elements equal to the specified object, there is no guarantee which instance will be found.
Parameters:
a - the array to be searched.
key - the value to be searched for.
Returns:
index of the search key, if it is contained in the array; otherwise, (-(the "insertion point") - 1).
See Also:
sort(byte[])

binarySearch

public static int binarySearch(double[] a,
                               double key)
Searches the specified array of doubles for the specified value using the binary search algorithm. The array must must be sorted (as by the sort method, above) prior to making this call. If it is not sorted, the results are undefined: in particular, the call may enter an infinite loop. If the array contains multiple elements equal to the specified object, there is no guarantee which instance will be found.
Parameters:
a - the array to be searched.
key - the value to be searched for.
Returns:
index of the search key, if it is contained in the array; otherwise, (-(the "insertion point") - 1).
See Also:
sort(double[])

binarySearch

public static int binarySearch(float[] a,
                               float key)
Searches the specified array of floats for the specified value using the binary search algorithm. The array must must be sorted (as by the sort method, above) prior to making this call. If it is not sorted, the results are undefined: in particular, the call may enter an infinite loop. If the array contains multiple elements equal to the specified object, there is no guarantee which instance will be found.
Parameters:
a - the array to be searched.
key - the value to be searched for.
Returns:
index of the search key, if it is contained in the array; otherwise, (-(the "insertion point") - 1).
See Also:
sort(float[])

binarySearch

public static int binarySearch(java.lang.Object[] a,
                               java.lang.Object key)
Searches the specified array for the specified Object using the binary search algorithm. The array must be sorted into ascending order according to the natural ordering of its elements (as by Sort(Object[]), above) prior to making this call. The array must must be sorted (as by the sort method, above) prior to making this call. If it is not sorted, the results are undefined: in particular, the call may enter an infinite loop. If the array contains multiple elements equal to the specified object, there is no guarantee which instance will be found.
Parameters:
a - the array to be searched.
key - the value to be searched for.
Returns:
index of the search key, if it is contained in the array; otherwise, (-(the "insertion point") - 1).
Throws:
ClassCastException - array contains elements that are not mutually comparable (for example, Strings and Integers), or the search key in not mutually comparable with the elements of the array.
See Also:
java.lang.Comparable, sort(Object[])

binarySearch

public static int binarySearch(java.lang.Object[] a,
                               java.lang.Object key,
                               Comparator c)
Searches the specified array for the specified Object using the binary search algorithm. The array must be sorted into ascending order according to the specified Comparator (as by Sort(Object[], Comparator), above), prior to making this call. If it is not sorted, the results are undefined: in particular, the call may enter an infinite loop. If the array contains multiple elements equal to the specified object, there is no guarantee which instance will be found.
Parameters:
a - the array to be searched.
key - the value to be searched for.
c - the Comparator to determine the order of the array.
Returns:
index of the search key, if it is contained in the array; otherwise, (-(the "insertion point") - 1).
Throws:
ClassCastException - array contains elements that are not mutually comparable with the specified Comparator, or the search key in not mutually comparable with the elements of the array using this Comparator.
See Also:
java.lang.Comparable, sort(Object[], Comparator)

equals

public static boolean equals(long[] a,
                             long[] a2)
Returns true if the the two specified arrays of longs are equal to one another. The two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, the two arrays are equal if they contain the same elements in the same order. Also, the arrays are considered equal if both are null.
Parameters:
a - one array to be tested for equality.
a2 - the other array to be tested for equality.
Returns:
true if the two arrays are equal.

equals

public static boolean equals(int[] a,
                             int[] a2)
Returns true if the the two specified arrays of ints are equal to one another. The two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, the two arrays are equal if they contain the same elements in the same order. Also, the arrays are considered equal if both are null.
Parameters:
a - one array to be tested for equality.
a2 - the other array to be tested for equality.
Returns:
true if the two arrays are equal.

equals

public static boolean equals(short[] a,
                             short[] a2)
Returns true if the the two specified arrays of shorts are equal to one another. The two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, the two arrays are equal if they contain the same elements in the same order. Also, the arrays are considered equal if both are null.
Parameters:
a - one array to be tested for equality.
a2 - the other array to be tested for equality.
Returns:
true if the two arrays are equal.

equals

public static boolean equals(char[] a,
                             char[] a2)
Returns true if the the two specified arrays of chars are equal to one another. The two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, the two arrays are equal if they contain the same elements in the same order. Also, the arrays are considered equal if both are null.
Parameters:
a - one array to be tested for equality.
a2 - the other array to be tested for equality.
Returns:
true if the two arrays are equal.

equals

public static boolean equals(byte[] a,
                             byte[] a2)
Returns true if the the two specified arrays of bytes are equal to one another. The two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, the two arrays are equal if they contain the same elements in the same order. Also, the arrays are considered equal if both are null.
Parameters:
a - one array to be tested for equality.
a2 - the other array to be tested for equality.
Returns:
true if the two arrays are equal.

equals

public static boolean equals(boolean[] a,
                             boolean[] a2)
Returns true if the the two specified arrays of booleans are equal to one another. The two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, the two arrays are equal if they contain the same elements in the same order. Also, the arrays are considered equal if both are null.
Parameters:
a - one array to be tested for equality.
a2 - the other array to be tested for equality.
Returns:
true if the two arrays are equal.

equals

public static boolean equals(double[] a,
                             double[] a2)
Returns true if the the two specified arrays of doubles are equal to one another. The two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, the two arrays are equal if they contain the same elements in the same order. Also, the arrays are considered equal if both are null.
Parameters:
a - one array to be tested for equality.
a2 - the other array to be tested for equality.
Returns:
true if the two arrays are equal.

equals

public static boolean equals(float[] a,
                             float[] a2)
Returns true if the the two specified arrays of floats are equal to one another. The two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal. In other words, the two arrays are equal if they contain the same elements in the same order. Also, the arrays are considered equal if both are null.
Parameters:
a - one array to be tested for equality.
a2 - the other array to be tested for equality.
Returns:
true if the two arrays are equal.

equals

public static boolean equals(java.lang.Object[] a,
                             java.lang.Object[] a2)
Returns true if the the two specified arrays of Objects are equal to one another. The two arrays are considered equal if both arrays contain the same number of elements, and all corresponding pairs of elements in the two arrays are equal (the two elements in a pair are considered equal if both are null). In other words, the two arrays are equal if they contain the same elements in the same order. Also, the arrays are considered equal if both are null.
Parameters:
a - one array to be tested for equality.
a2 - the other array to be tested for equality.
Returns:
true if the two arrays are equal.

fill

public static void fill(long[] a,
                        long val)
Sets each element of the specified array of longs with the specified long value.
Parameters:
a - the array to be filled.
val - the value to be stored in all elements of the array.

fill

public static void fill(long[] a,
                        int fromIndex,
                        int toIndex,
                        long val)
Sets the specified range of elements in the specified array of longs with the specified long value.
Parameters:
a - the array to be filled.
fromIndex - the index of the first element (inclusive) to be filled with the specified value.
toIndex - the index of the last element (inclusive) to be filled with the specified value.
val - the value to be stored in all elements of the array.

fill

public static void fill(int[] a,
                        int val)
Sets each element of the specified array of ints with the specified int value.
Parameters:
a - the array to be filled.
val - the value to be stored in all elements of the array.

fill

public static void fill(int[] a,
                        int fromIndex,
                        int toIndex,
                        int val)
Sets the specified range of elements in the specified array of ints with the specified int value.
Parameters:
a - the array to be filled.
fromIndex - the index of the first element (inclusive) to be filled with the specified value.
toIndex - the index of the last element (inclusive) to be filled with the specified value.
val - the value to be stored in all elements of the array.

fill

public static void fill(short[] a,
                        short val)
Sets each element of the specified array of shorts with the specified short value.
Parameters:
a - the array to be filled.
val - the value to be stored in all elements of the array.

fill

public static void fill(short[] a,
                        int fromIndex,
                        int toIndex,
                        short val)
Sets the specified range of elements in the specified array of shorts with the specified short value.
Parameters:
a - the array to be filled.
fromIndex - the index of the first element (inclusive) to be filled with the specified value.
toIndex - the index of the last element (inclusive) to be filled with the specified value.
val - the value to be stored in all elements of the array.

fill

public static void fill(char[] a,
                        char val)
Sets each element of the specified array of chars with the specified char value.
Parameters:
a - the array to be filled.
val - the value to be stored in all elements of the array.

fill

public static void fill(char[] a,
                        int fromIndex,
                        int toIndex,
                        char val)
Sets the specified range of elements in the specified array of chars with the specified char value.
Parameters:
a - the array to be filled.
fromIndex - the index of the first element (inclusive) to be filled with the specified value.
toIndex - the index of the last element (inclusive) to be filled with the specified value.
val - the value to be stored in all elements of the array.

fill

public static void fill(byte[] a,
                        byte val)
Sets each element of the specified array of bytes with the specified byte value.
Parameters:
a - the array to be filled.
val - the value to be stored in all elements of the array.

fill

public static void fill(byte[] a,
                        int fromIndex,
                        int toIndex,
                        byte val)
Sets the specified range of elements in the specified array of bytes with the specified byte value.
Parameters:
a - the array to be filled.
fromIndex - the index of the first element (inclusive) to be filled with the specified value.
toIndex - the index of the last element (inclusive) to be filled with the specified value.
val - the value to be stored in all elements of the array.

fill

public static void fill(boolean[] a,
                        boolean val)
Sets each element of the specified array of booleans with the specified boolean value.
Parameters:
a - the array to be filled.
val - the value to be stored in all elements of the array.

fill

public static void fill(boolean[] a,
                        int fromIndex,
                        int toIndex,
                        boolean val)
Sets the specified range of elements in the specified array of booleans with the specified boolean value.
Parameters:
a - the array to be filled.
fromIndex - the index of the first element (inclusive) to be filled with the specified value.
toIndex - the index of the last element (inclusive) to be filled with the specified value.
val - the value to be stored in all elements of the array.

fill

public static void fill(double[] a,
                        double val)
Sets each element of the specified array of doubles with the specified double value.
Parameters:
a - the array to be filled.
val - the value to be stored in all elements of the array.

fill

public static void fill(double[] a,
                        int fromIndex,
                        int toIndex,
                        double val)
Sets the specified range of elements in the specified array of doubles with the specified double value.
Parameters:
a - the array to be filled.
fromIndex - the index of the first element (inclusive) to be filled with the specified value.
toIndex - the index of the last element (inclusive) to be filled with the specified value.
val - the value to be stored in all elements of the array.

fill

public static void fill(float[] a,
                        float val)
Sets each element of the specified array of floats with the specified float value.
Parameters:
a - the array to be filled.
val - the value to be stored in all elements of the array.

fill

public static void fill(float[] a,
                        int fromIndex,
                        int toIndex,
                        float val)
Sets the specified range of elements in the specified array of floats with the specified float value.
Parameters:
a - the array to be filled.
fromIndex - the index of the first element (inclusive) to be filled with the specified value.
toIndex - the index of the last element (inclusive) to be filled with the specified value.
val - the value to be stored in all elements of the array.

fill

public static void fill(java.lang.Object[] a,
                        java.lang.Object val)
Sets each element of the specified array of Objects with the specified Object value.
Parameters:
a - the array to be filled.
val - the value to be stored in all elements of the array.

fill

public static void fill(java.lang.Object[] a,
                        int fromIndex,
                        int toIndex,
                        java.lang.Object val)
Sets the specified range of elements in the specified array of Objectss with the specified Objects value.
Parameters:
a - the array to be filled.
fromIndex - the index of the first element (inclusive) to be filled with the specified value.
toIndex - the index of the last element (inclusive) to be filled with the specified value.
val - the value to be stored in all elements of the array.

asList

public static List asList(java.lang.Object[] a)
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 Collection.toArray. The returned List is Serializable.
Parameters:
a - the array by which the List will be backed.
Returns:
a List view of the specified array.
See Also:
toArray()

Overview | Package | Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD