All Packages Class Hierarchy This Package Previous Next Index
Class list.List
java.lang.Object
|
+----list.List
- public class List
- extends Object
Dies ist eine Implementierung von funktionalen Listen mit
einer Konstanten nil, die die leere Liste repräsentiert und einer
Klassenmethode cons(hd,tl) für die Cons-Operation. Jedesmal, wenn
eine Element zu einer Liste hinzugefügt wird, wird ein neue Liste
erzeugt anstatt die alte Liste zu verändern.
- Author:
- Hubert Baumeister
-
nil
- Die Konstante nil repräsentiert die leere Liste.
-
add(Object)
- Es wird eine neue Liste erzeugt mit Kopf hd
und this als dem Rest.
-
add(Object[])
- Diese Operation fügt alle Elemente des Arrays der Reihe nach
zu this hinzu.
-
append(List)
- Fügt die Liste l an this an.
-
cons(Object, List)
- Diese Operation erzeugt eine neue Liste mit hd
als Kopf und tl als Rest.
-
hd()
- Gibt den Kopf von this zurück.
-
isNil()
- Liefert true, wenn this die leere Liste ist, false sonst.
-
tl()
- Gibt this ohne den Kopf zurück.
nil
public final static List nil
- Die Konstante nil repräsentiert die leere Liste.
cons
public static List cons(Object hd,
List tl)
- Diese Operation erzeugt eine neue Liste mit hd
als Kopf und tl als Rest.
hd
public abstract Object hd()
- Gibt den Kopf von this zurück. Es wird eine
EmptyListException erzeugt, falls this keine Elemente enthält.
tl
public abstract List tl()
- Gibt this ohne den Kopf zurück. Es wird eine
EmptyListException erzeugt, falls this keine Elemente enthält.
append
public abstract List append(List l)
- Fügt die Liste l an this an.
isNil
public boolean isNil()
- Liefert true, wenn this die leere Liste ist, false sonst.
add
public List add(Object o)
- Es wird eine neue Liste erzeugt mit Kopf hd
und this als dem Rest.
add
public List add(Object oa[])
- Diese Operation fügt alle Elemente des Arrays der Reihe nach
zu this hinzu.
All Packages Class Hierarchy This Package Previous Next Index
Imprint | Data Protection