public static void fill(Object[] a, int fromIndex, int toIndex, Object val)

来源:互联网 发布:男生基本款衬衫 知乎 编辑:程序博客网 时间:2024/04/28 23:24

java.lang.Object

  extended by 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 voidfill(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 indexfromIndex, 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 - iffromIndex > toIndex
ArrayIndexOutOfBoundsException - iffromIndex < 0 or toIndex > a.length
ArrayStoreException - if the specified value is not of a runtime type that can be stored in the specified array
0 0
原创粉丝点击