» Referenzen / Klassen / Array

Diese Klasse stellt eine Vielzahl statischer Methoden für den Zugriff und die Erzeugung von Arrays bereit.

» ab JDK Version 1.0



public final class Array
extends Object
    

» Object


keine


» Elemente

In der folgenden Liste sind alle von uns bereits referenzierten Elemente der Klasse aufgeführt.

» Methoden » Konstruktoren

» get
» getBoolean
» getByte
» getChar
» getDouble
» getFloat
» getInt
» getLenght
» getLong
» getShort
» newInstance [1][2]
» set
» setBoolean
» setByte
» setChar
» setDouble
» setFloat
» setInt
» setLong
» setShort


keine

» Datenelemente » Destruktoren

keine


keine


» Methoden / get *

Die Methoden liefern jeweils ein bestimmtes Element eines Arrays.

» Prototyp

public static  Object get       (Object array,int index)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static boolean getBoolean(Object array,int index)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static    byte getByte   (Object array,int index)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static    char getChar   (Object array,int index)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static  double getDouble (Object array,int index)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static   float getFloat  (Object array,int index)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static     int getInt    (Object array,int index)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static    long getLong   (Object array,int index)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static   short getShort  (Object array,int index)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
    
» Parameter

array Das Array aus dem ein Element geliefert werden soll.
index Die Indexposition des Elements.

» Rückgabe

Wert Das Element an der spezifischen Indexposition.

» Ausnahmen & Fehler

ArrayIndexOutOfBoundsException
Die Indexangabe ist negativ oder liegt außerhalb des Arrays.
NullPointerException
Die Referenz auf das Array ist null.
IllegalArgumentException
Das übergebene Objekt ist kein Array oder das Indexelement kann nicht in den gewünschten Typ konvertiert werden.

» ab JDK Version alle 1.0

» Methoden / getLenght

Die Methoden liefern die aktuelle Anzahl der Elemente im Array.

» Prototyp

public static int getLength(Object array)
throws IllegalArgumentException
    
» Parameter

array Das Array dessen Elementanzahl ermittelt werden soll.

» Rückgabe

Wert Anzahl der Elemente im Array.

» Ausnahmen & Fehler

IllegalArgumentException
Das übergebene Objekt ist kein Array.

» ab JDK Version 1.0

» Methoden / newInstance [1]

Die Methoden erzeugt ein neues Array vom spezifizierten Typ und einer bestimmten Anzahl von Elementen.

» Prototyp

public static Object newInstance(Class type,int length)
throws NegativeArraySizeException
    
» Parameter

type Datentyp der Elemente im Array.
length Anzahl der Elemente im Array.

» Rückgabe

Objekt Das neue Array.

» Ausnahmen & Fehler

NullPointerException
Der spezifizierte Datentyp ist null.
NegativeArraySizeException
Die Angabe der Anzahl der Elemente ist negativ.

» ab JDK Version 1.0

» Methoden / newInstance [2]

Die Methoden erzeugt ein neues mehrdimensionales Array vom spezifizierten Typ und einer bestimmten Anzahl von Elementen.

» Prototyp

public static Object newInstance(Class type,int[] dimension)
throws IllegalArgumentException,NegativeArraySizeException
    
» Parameter

type Datentyp der Elemente im Array.
dimension Ein Array von Werten welches die Größe der Dimensionen angibt.

» Rückgabe

Objekt Das neue Array.

» Ausnahmen & Fehler

NullPointerException
Der spezifizierte Datentyp ist null.
NegativeArraySizeException
Die Angabe der Anzahl der Elemente ist negativ.
IllegalArgumentException
Die Dimensionsangaben sind null oder überschreiten das Maximum von 255 Dimensionen.

» ab JDK Version 1.0

» Methoden / set *

Die Methoden weist einem Arrayelement einen neuen Wert zu.

» Prototyp

public static void set       (Object array,int index, Object value)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static void setBoolean(Object array,int index,boolean value)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static void setByte   (Object array,int index,   byte value)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static void setChar   (Object array,int index,   char value)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static void setDouble (Object array,int index, double value)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static void setFloat  (Object array,int index,  float value)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static void setInt    (Object array,int index,    int value)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static void setLong   (Object array,int index,   long value)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
public static void setShort  (Object array,int index,  short value)
throws IllegalArgumentException,ArrayIndexOutOfBoundsException
    
» Parameter

array Das Array dessen spezifischen Element ein neuer Wert zugewiesen werden soll.
index Die Indexposition des Elements.
value Der neue Wert des Elements.

» Rückgabe

keine

» Ausnahmen & Fehler

ArrayIndexOutOfBoundsException
Die Indexangabe ist negativ oder liegt außerhalb des Arrays.
NullPointerException
Die Referenz auf das Array ist null.
IllegalArgumentException
Das übergebene Objekt ist kein Array oder das Indexelement kann nicht in den gewünschten Typ konvertiert werden.

» ab JDK Version alle 1.0