All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.lang.reflect.Array

java.lang.Object
   |
   +----java.lang.reflect.Array

public final class Array
extends Object
The Array class provides static methods to dynamically create and access Java arrays.

Array permits widening conversions to occur during a get or set operation, but throws an IllegalArgumentException if a narrowing conversion would occur.


Method Index

 o get(Object, int)
Returns the value of the indexed component in the specified array object.
 o getBoolean(Object, int)
Returns the value of the indexed component in the specified array object, as a boolean.
 o getByte(Object, int)
Returns the value of the indexed component in the specified array object, as a byte.
 o getChar(Object, int)
Returns the value of the indexed component in the specified array object, as a char.
 o getDouble(Object, int)
Returns the value of the indexed component in the specified array object, as a double.
 o getFloat(Object, int)
Returns the value of the indexed component in the specified array object, as a float.
 o getInt(Object, int)
Returns the value of the indexed component in the specified array object, as an int.
 o getLength(Object)
Returns the length of the specified array object, as an int.
 o getLong(Object, int)
Returns the value of the indexed component in the specified array object, as a long.
 o getShort(Object, int)
Returns the value of the indexed component in the specified array object, as a short.
 o newInstance(Class, int)
Creates a new array with the specified component type and length.
 o newInstance(Class, int[])
Creates a new array with the specified component type and dimensions.
 o set(Object, int, Object)
Sets the value of the indexed component of the specified array object to the specified new value.
 o setBoolean(Object, int, boolean)
Sets the value of the indexed component of the specified array object to the specified boolean value.
 o setByte(Object, int, byte)
Sets the value of the indexed component of the specified array object to the specified boolean value.
 o setChar(Object, int, char)
Sets the value of the indexed component of the specified array object to the specified byte value.
 o setDouble(Object, int, double)
Sets the value of the indexed component of the specified array object to the specified double value.
 o setFloat(Object, int, float)
Sets the value of the indexed component of the specified array object to the specified float value.
 o setInt(Object, int, int)
Sets the value of the indexed component of the specified array object to the specified int value.
 o setLong(Object, int, long)
Sets the value of the indexed component of the specified array object to the specified long value.
 o setShort(Object, int, short)
Sets the value of the indexed component of the specified array object to the specified short value.

Methods

 o newInstance
    method newInstance(componentType=Class, -
                       length=int) returns Object public  static   Signals NegativeArraySizeException
Creates a new array with the specified component type and length. The effect is that of the equivalent array creation expression:
    new componentType[length]
 

Parameters:
componentType - the Class object representing the component type of the new array
length - the length of the new array
Returns:
the new array
Throws: NullPointerException
if the specified componentType parameter is null
Throws: NegativeArraySizeException
if the specified length is negative
 o newInstance
    method newInstance(componentType=Class, -
                       dimensions=int[]) returns Object public  static   Signals IllegalArgumentException, NegativeArraySizeException
Creates a new array with the specified component type and dimensions.

The effect is that of the equivalent array creation expression:

    new componentType[dimensions[0]][dimensions[1]]...
 

Parameters:
componentType - the Class object representing the component type of the new array
dimensions - an array of ints representing the dimensions of the new array
Returns:
the new array
Throws: NullPointerException
if the specified componentType argument is null
Throws: IllegalArgumentException
if the specified dimensions argument is a zero-dimensional array, or if the number of requested dimensions exceeds the limit on the number of array dimensions supported by the implementation (typically 255).
Throws: NegativeArraySizeException
if any of the components in the specified dimension argument is negative.
 o getLength
    method getLength(array=Object) returns int public  static   Signals IllegalArgumentException
Returns the length of the specified array object, as an int.

Parameters:
array - the array
Returns:
the length of the array
Throws: IllegalArgumentException
if the object argument is not an array
 o get
    method get(array=Object, -
               index=int) returns Object public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Returns the value of the indexed component in the specified array object. The value is automatically wrapped in an object if it has a primitive type.

Parameters:
array - the array
index - the index
Returns:
the (possibly wrapped) value of the indexed component in the specified array
Throws: NullPointerException
If the specified object is null
Throws: IllegalArgumentException
If the specified object is not an array
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
 o getBoolean
    method getBoolean(array=Object, -
                      index=int) returns boolean public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Returns the value of the indexed component in the specified array object, as a boolean.

Parameters:
array - the array
index - the index
Returns:
the value of the indexed component in the specified array
Throws: NullPointerException
If the specified object is null
Throws: IllegalArgumentException
If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
get
 o getByte
    method getByte(array=Object, -
                   index=int) returns byte public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Returns the value of the indexed component in the specified array object, as a byte.

Parameters:
array - the array
index - the index
Returns:
the value of the indexed component in the specified array
Throws: NullPointerException
If the specified object is null
Throws: IllegalArgumentException
If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
get
 o getChar
    method getChar(array=Object, -
                   index=int) returns char public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Returns the value of the indexed component in the specified array object, as a char.

Parameters:
array - the array
index - the index
Returns:
the value of the indexed component in the specified array
Throws: NullPointerException
If the specified object is null
Throws: IllegalArgumentException
If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
get
 o getShort
    method getShort(array=Object, -
                    index=int) returns short public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Returns the value of the indexed component in the specified array object, as a short.

Parameters:
array - the array
index - the index
Returns:
the value of the indexed component in the specified array
Throws: NullPointerException
If the specified object is null
Throws: IllegalArgumentException
If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
get
 o getInt
    method getInt(array=Object, -
                  index=int) returns int public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Returns the value of the indexed component in the specified array object, as an int.

Parameters:
array - the array
index - the index
Returns:
the value of the indexed component in the specified array
Throws: NullPointerException
If the specified object is null
Throws: IllegalArgumentException
If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
get
 o getLong
    method getLong(array=Object, -
                   index=int) returns long public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Returns the value of the indexed component in the specified array object, as a long.

Parameters:
array - the array
index - the index
Returns:
the value of the indexed component in the specified array
Throws: NullPointerException
If the specified object is null
Throws: IllegalArgumentException
If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
get
 o getFloat
    method getFloat(array=Object, -
                    index=int) returns float public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Returns the value of the indexed component in the specified array object, as a float.

Parameters:
array - the array
index - the index
Returns:
the value of the indexed component in the specified array
Throws: NullPointerException
If the specified object is null
Throws: IllegalArgumentException
If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
get
 o getDouble
    method getDouble(array=Object, -
                     index=int) returns double public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Returns the value of the indexed component in the specified array object, as a double.

Parameters:
array - the array
index - the index
Returns:
the value of the indexed component in the specified array
Throws: NullPointerException
If the specified object is null
Throws: IllegalArgumentException
If the specified object is not an array, or if the indexed element cannot be converted to the return type by an identity or widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
get
 o set
    method set(array=Object, -
               index=int, -
               value=Object)  public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified new value. The new value is first automatically unwrapped if the array has a primitive component type.

Parameters:
array - the array
index - the index into the array
value - the new value of the indexed component
Throws: NullPointerException
If the specified object argument is null, or if the array component type is primitive and the specified value is null
Throws: IllegalArgumentException
If the specified object argument is not an array, or if the array component type is primitive and the specified value cannot be converted to the primitive type by a combination of unwrapping and identity or widening conversions
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
 o setBoolean
    method setBoolean(array=Object, -
                      index=int, -
                      z=boolean)  public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified boolean value.

Parameters:
array - the array
index - the index into the array
value - the new value of the indexed component
Throws: NullPointerException
If the specified object argument is null
Throws: IllegalArgumentException
If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
set
 o setByte
    method setByte(array=Object, -
                   index=int, -
                   b=byte)  public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified boolean value.

Parameters:
array - the array
index - the index into the array
value - the new value of the indexed component
Throws: NullPointerException
If the specified object argument is null
Throws: IllegalArgumentException
If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
set
 o setChar
    method setChar(array=Object, -
                   index=int, -
                   c=char)  public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified byte value.

Parameters:
array - the array
index - the index into the array
value - the new value of the indexed component
Throws: NullPointerException
If the specified object argument is null
Throws: IllegalArgumentException
If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
set
 o setShort
    method setShort(array=Object, -
                    index=int, -
                    s=short)  public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified short value.

Parameters:
array - the array
index - the index into the array
value - the new value of the indexed component
Throws: NullPointerException
If the specified object argument is null
Throws: IllegalArgumentException
If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
set
 o setInt
    method setInt(array=Object, -
                  index=int, -
                  i=int)  public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified int value.

Parameters:
array - the array
index - the index into the array
value - the new value of the indexed component
Throws: NullPointerException
If the specified object argument is null
Throws: IllegalArgumentException
If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
set
 o setLong
    method setLong(array=Object, -
                   index=int, -
                   l=long)  public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified long value.

Parameters:
array - the array
index - the index into the array
value - the new value of the indexed component
Throws: NullPointerException
If the specified object argument is null
Throws: IllegalArgumentException
If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
set
 o setFloat
    method setFloat(array=Object, -
                    index=int, -
                    f=float)  public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified float value.

Parameters:
array - the array
index - the index into the array
value - the new value of the indexed component
Throws: NullPointerException
If the specified object argument is null
Throws: IllegalArgumentException
If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
set
 o setDouble
    method setDouble(array=Object, -
                     index=int, -
                     d=double)  public  static   Signals IllegalArgumentException, ArrayIndexOutOfBoundsException
Sets the value of the indexed component of the specified array object to the specified double value.

Parameters:
array - the array
index - the index into the array
value - the new value of the indexed component
Throws: NullPointerException
If the specified object argument is null
Throws: IllegalArgumentException
If the specified object argument is not an array, or if the the specified value cannot be converted to the underlying array's component type by an identity or a primitive widening widening conversion
Throws: ArrayIndexOutOfBoundsException
If the specified index argument is negative, or if it is greater than or equal to the length of the specified array
See Also:
set

All Packages  Class Hierarchy  This Package  Previous  Next  Index