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.
Access | Constructor and Description |
---|---|
private |
Modifier and Type | Method and Description |
---|---|
public static native Object | |
public static native boolean | Returns: the value of the indexed component in the specified arraythe array array, int the index index)Returns the value of the indexed component in the specified
array object, as a |
public static native byte | |
public static native char | |
public static native double | |
public static native float | |
public static native int | |
public static native int | |
public static native long | |
public static native short | |
private static native Object | |
private static native Object | |
public static Object | Returns: the new arraythe componentType, int Class object representing the
component type of the new arraythe length of the new array length)Creates a new array with the specified component type and length. |
public static Object | Returns: the new arraythe componentType, int... Class object representing the component
type of the new arrayan array of dimensions)int representing the dimensions of
the new arrayCreates a new array with the specified component type and dimensions. |
public static native void | |
public static native void | setBoolean(Object
the array array, int the index into the array index, boolean the new value of the indexed component z)Sets the value of the indexed component of the specified array
object to the specified |
public static native void | |
public static native void | |
public static native void | |
public static native void | |
public static native void | |
public static native void | |
public static native void |
Array | back to summary |
---|---|
private Array() Constructor. Class Array is not instantiable. |
get | back to summary |
---|---|
public static native Object get(Object array, int index) throws 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.
|
getBoolean | back to summary |
---|---|
public static native boolean getBoolean(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Returns the value of the indexed component in the specified
array object, as a
|
getByte | back to summary |
---|---|
public static native byte getByte(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Returns the value of the indexed component in the specified
array object, as a
|
getChar | back to summary |
---|---|
public static native char getChar(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Returns the value of the indexed component in the specified
array object, as a
|
getDouble | back to summary |
---|---|
public static native double getDouble(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Returns the value of the indexed component in the specified
array object, as a
|
getFloat | back to summary |
---|---|
public static native float getFloat(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Returns the value of the indexed component in the specified
array object, as a
|
getInt | back to summary |
---|---|
public static native int getInt(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Returns the value of the indexed component in the specified
array object, as an
|
getLength | back to summary |
---|---|
public static native int getLength(Object array) throws IllegalArgumentException Returns the length of the specified array object, as an
|
getLong | back to summary |
---|---|
public static native long getLong(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Returns the value of the indexed component in the specified
array object, as a
|
getShort | back to summary |
---|---|
public static native short getShort(Object array, int index) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Returns the value of the indexed component in the specified
array object, as a
|
multiNewArray | back to summary |
---|---|
private static native Object multiNewArray(Class<?> componentType, int[] dimensions) throws IllegalArgumentException, NegativeArraySizeException |
newArray | back to summary |
---|---|
private static native Object newArray(Class<?> componentType, int length) throws NegativeArraySizeException
|
newInstance | back to summary |
---|---|
public static Object newInstance(Class<?> componentType, int length) throws NegativeArraySizeException Creates a new array with the specified component type and length. Implementation Specification Invoking this method is equivalent to creating an array as follows:
The number of dimensions of the new array must not exceed 255.
|
newInstance | back to summary |
---|---|
public static Object newInstance(Class<?> componentType, int... dimensions) throws IllegalArgumentException, NegativeArraySizeException Creates a new array
with the specified component type and dimensions.
If The number of dimensions of the new array must not exceed 255.
|
set | back to summary |
---|---|
public static native void set(Object array, int index, Object value) throws 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.
|
setBoolean | back to summary |
---|---|
public static native void setBoolean(Object array, int index, boolean z) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Sets the value of the indexed component of the specified array
object to the specified
|
setByte | back to summary |
---|---|
public static native void setByte(Object array, int index, byte b) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Sets the value of the indexed component of the specified array
object to the specified
|
setChar | back to summary |
---|---|
public static native void setChar(Object array, int index, char c) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Sets the value of the indexed component of the specified array
object to the specified
|
setDouble | back to summary |
---|---|
public static native void setDouble(Object array, int index, double d) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Sets the value of the indexed component of the specified array
object to the specified
|
setFloat | back to summary |
---|---|
public static native void setFloat(Object array, int index, float f) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Sets the value of the indexed component of the specified array
object to the specified
|
setInt | back to summary |
---|---|
public static native void setInt(Object array, int index, int i) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Sets the value of the indexed component of the specified array
object to the specified
|
setLong | back to summary |
---|---|
public static native void setLong(Object array, int index, long l) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Sets the value of the indexed component of the specified array
object to the specified
|
setShort | back to summary |
---|---|
public static native void setShort(Object array, int index, short s) throws IllegalArgumentException, ArrayIndexOutOfBoundsException Sets the value of the indexed component of the specified array
object to the specified
|