java.lang.Object | |
↳ | java.lang.reflect.Array |
This class provides static methods to create and access arrays dynamically.
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the element of the array at the specified index.
| |||||||||||
Returns the element of the array at the specified index, converted to a
boolean , if possible. | |||||||||||
Returns the element of the array at the specified index, converted to a
byte , if possible. | |||||||||||
Returns the element of the array at the specified index, converted to a
char , if possible. | |||||||||||
Returns the element of the array at the specified index, converted to a
double , if possible. | |||||||||||
Returns the element of the array at the specified index, converted to a
float , if possible. | |||||||||||
Returns the element of the array at the specified index, converted to an
int , if possible. | |||||||||||
Returns the length of the array.
| |||||||||||
Returns the element of the array at the specified index, converted to a
long , if possible. | |||||||||||
Returns the element of the array at the specified index, converted to a
short , if possible. | |||||||||||
Returns a new multidimensional array of the specified component type and
dimensions.
| |||||||||||
Returns a new array of the specified component type and length.
| |||||||||||
Sets the element of the array at the specified index to the value.
| |||||||||||
Sets the element of the array at the specified index to the
boolean value. | |||||||||||
Sets the element of the array at the specified index to the
byte
value. | |||||||||||
Set the element of the array at the specified index to the
char
value. | |||||||||||
Set the element of the array at the specified index to the
double
value. | |||||||||||
Set the element of the array at the specified index to the
float
value. | |||||||||||
Set the element of the array at the specified index to the
int
value. | |||||||||||
Set the element of the array at the specified index to the
long
value. | |||||||||||
Set the element of the array at the specified index to the
short
value. |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Returns the element of the array at the specified index. This reproduces
the effect of array[index]
. If the array component is a primitive
type, the result is automatically wrapped.
array | the array |
---|---|
index | the index |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if array is not an array |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Returns the element of the array at the specified index, converted to a
boolean
, if possible. This reproduces the effect of array[index]
array | the array |
---|---|
index | the index |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if array is not an array or the element at the
index position can not be converted to the return type |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Returns the element of the array at the specified index, converted to a
byte
, if possible. This reproduces the effect of array[index]
array | the array |
---|---|
index | the index |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if array is not an array or the element at the
index position can not be converted to the return type |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Returns the element of the array at the specified index, converted to a
char
, if possible. This reproduces the effect of array[index]
array | the array |
---|---|
index | the index |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if array is not an array or the element at the
index position can not be converted to the return type |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Returns the element of the array at the specified index, converted to a
double
, if possible. This reproduces the effect of array[index]
array | the array |
---|---|
index | the index |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if array is not an array or the element at the
index position can not be converted to the return type |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Returns the element of the array at the specified index, converted to a
float
, if possible. This reproduces the effect of array[index]
array | the array |
---|---|
index | the index |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if array is not an array or the element at the
index position can not be converted to the return type |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Returns the element of the array at the specified index, converted to an
int
, if possible. This reproduces the effect of array[index]
array | the array |
---|---|
index | the index |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if array is not an array or the element at the
index position can not be converted to the return type |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Returns the length of the array. This reproduces the effect of array.length
array | the array |
---|
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if array is not an array |
Returns the element of the array at the specified index, converted to a
long
, if possible. This reproduces the effect of array[index]
array | the array |
---|---|
index | the index |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if array is not an array or the element at the
index position can not be converted to the return type |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Returns the element of the array at the specified index, converted to a
short
, if possible. This reproduces the effect of array[index]
array | the array |
---|---|
index | the index |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if array is not an array or the element at the
index position can not be converted to the return type |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Returns a new multidimensional array of the specified component type and
dimensions. This reproduces the effect of new
componentType[d0][d1]...[dn]
for a dimensions array of { d0, d1, ... ,
dn }.
componentType | the component type of the new array |
---|---|
dimensions | the dimensions of the new array |
NullPointerException | if the component type is null |
---|---|
NegativeArraySizeException | if any of the dimensions are negative |
IllegalArgumentException | if the array of dimensions is of size zero, or exceeds the limit of the number of dimension for an array (currently 255) |
Returns a new array of the specified component type and length. This
reproduces the effect of new componentType[size]
.
componentType | the component type of the new array |
---|---|
size | the length of the new array |
NullPointerException | if the component type is null |
---|---|
NegativeArraySizeException | if size < 0 |
Sets the element of the array at the specified index to the value. This
reproduces the effect of array[index] = value
. If the array
component is a primitive type, the value is automatically unwrapped.
array | the array |
---|---|
index | the index |
value | the new value |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if array is not an array or the value cannot be
converted to the array type by a widening conversion |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Sets the element of the array at the specified index to the boolean
value. This reproduces the effect of array[index] =
value
.
array | the array |
---|---|
index | the index |
value | the new value |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if the array is not an array or the value cannot be
converted to the array type by a widening conversion |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Sets the element of the array at the specified index to the byte
value. This reproduces the effect of array[index] = value
.
array | the array |
---|---|
index | the index |
value | the new value |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if the array is not an array or the value cannot be
converted to the array type by a widening conversion |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Set the element of the array at the specified index to the char
value. This reproduces the effect of array[index] = value
.
array | the array |
---|---|
index | the index |
value | the new value |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if the array is not an array or the value cannot be
converted to the array type by a widening conversion |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Set the element of the array at the specified index to the double
value. This reproduces the effect of array[index] = value
.
array | the array |
---|---|
index | the index |
value | the new value |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if the array is not an array or the value cannot be
converted to the array type by a widening conversion |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Set the element of the array at the specified index to the float
value. This reproduces the effect of array[index] = value
.
array | the array |
---|---|
index | the index |
value | the new value |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if the array is not an array or the value cannot be
converted to the array type by a widening conversion |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Set the element of the array at the specified index to the int
value. This reproduces the effect of array[index] = value
.
array | the array |
---|---|
index | the index |
value | the new value |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if the array is not an array or the value cannot be
converted to the array type by a widening conversion |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Set the element of the array at the specified index to the long
value. This reproduces the effect of array[index] = value
.
array | the array |
---|---|
index | the index |
value | the new value |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if the array is not an array or the value cannot be
converted to the array type by a widening conversion |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |
Set the element of the array at the specified index to the short
value. This reproduces the effect of array[index] = value
.
array | the array |
---|---|
index | the index |
value | the new value |
NullPointerException | if the array is null |
---|---|
IllegalArgumentException | if the array is not an array or the value cannot be
converted to the array type by a widening conversion |
ArrayIndexOutOfBoundsException | if index < 0 || index >= array.length |