Class Array

java.lang.Object
java.lang.reflect.Array

public final class Array extends Object
This class provides methods to dynamically create and access arrays.
  • Method Summary

    Modifier and Type
    Method
    Description
    static Object
    get(Object array, int index)
    Return the element of the array at the specified index.
    static boolean
    getBoolean(Object array, int index)
    Return the element of the array at the specified index, converted to a boolean if possible.
    static byte
    getByte(Object array, int index)
    Return the element of the array at the specified index, converted to a byte if possible.
    static char
    getChar(Object array, int index)
    Return the element of the array at the specified index, converted to a char if possible.
    static double
    getDouble(Object array, int index)
    Return the element of the array at the specified index, converted to a double if possible.
    static float
    getFloat(Object array, int index)
    Return the element of the array at the specified index, converted to a float if possible.
    static int
    getInt(Object array, int index)
    Return the element of the array at the specified index, converted to an int if possible.
    static int
    Return the length of the array.
    static long
    getLong(Object array, int index)
    Return the element of the array at the specified index, converted to a long if possible.
    static short
    getShort(Object array, int index)
    Return the element of the array at the specified index, converted to a short if possible.
    static Object
    newInstance(Class<?> componentType, int size)
    Return a new array of the specified component type and length.
    static Object
    newInstance(Class<?> componentType, int... dimensions)
    Return a new multidimensional array of the specified component type and dimensions.
    static void
    set(Object array, int index, Object value)
    Set the element of the array at the specified index to the value.
    static void
    setBoolean(Object array, int index, boolean value)
    Set the element of the array at the specified index to the boolean value.
    static void
    setByte(Object array, int index, byte value)
    Set the element of the array at the specified index to the byte value.
    static void
    setChar(Object array, int index, char value)
    Set the element of the array at the specified index to the char value.
    static void
    setDouble(Object array, int index, double value)
    Set the element of the array at the specified index to the double value.
    static void
    setFloat(Object array, int index, float value)
    Set the element of the array at the specified index to the float value.
    static void
    setInt(Object array, int index, int value)
    Set the element of the array at the specified index to the int value.
    static void
    setLong(Object array, int index, long value)
    Set the element of the array at the specified index to the long value.
    static void
    setShort(Object array, int index, short value)
    Set the element of the array at the specified index to the short value.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.