java.lang.Object
java.util.Arrays
public class Arrays extends Object
This class contains various methods for manipulating arrays (such as sorting and searching). This class also contains a static factory that allows arrays to be viewed as lists.
The methods in this class all throw a NullPointerException if the specified array reference is null, except where noted.
The documentation for the methods contained in this class includes briefs description of the implementations. Such descriptions should be regarded as implementation notes, rather than parts of the specification. Implementors should feel free to substitute other algorithms, so long as the specification itself is adhered to. (For example, the algorithm used by sort(Object[]) does not have to be a mergesort, but it does have to be stable.)
This class is a member of the Java Collections Framework.
static void | fill(Object[] a,
int fromIndex, int toIndex, Object val) Assigns the specified Object reference to each element of the specified range of the specified array of Objects. |
public static void fill(Object[] a, int fromIndex, int toIndex, Object val)
- Assigns the specified Object reference to each element of the specified range of the specified array of Objects. The range to be filled extends from index fromIndex, inclusive, to index toIndex, exclusive. (If fromIndex==toIndex, the range to be filled is empty.)
-
-
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 (exclusive) to be filled with the specified value -
val
- the value to be stored in all elements of the array
Throws:
-
IllegalArgumentException
- if fromIndex > toIndex -
ArrayIndexOutOfBoundsException
- if fromIndex < 0 or toIndex > a.length -
ArrayStoreException
- if the specified value is not of a runtime type that can be stored in the specified array
-