Go to file
Lukas Klipfel 08fd3f0f1f Add TestCases 2026-01-16 16:37:53 +01:00
src/de/hs_mannheim/MeineArrayList Add TestCases 2026-01-16 16:37:53 +01:00
.classpath Add TestCases 2026-01-16 16:37:53 +01:00
.gitignore Add TestCases 2026-01-16 16:37:53 +01:00
.project Add TestCases 2026-01-16 16:37:53 +01:00
LICENSE Initial commit 2025-12-24 16:55:45 +01:00
README.md Add TestCases 2026-01-16 16:37:53 +01:00

README.md

PR1_Aufgabensammlung_Erstelle_Arraylist

In diesem Repo finden Sie die Aufgabenstellung mit Tests. Sie müssen lediglich die Klasse MeineArrayList fertig implementieren. Mit Hilfe der Tests wissen Sie, ob die Aufgabe korrekt ist.

Aufgabe

Implementieren Sie die Klasse MeineArrayList so, dass sie die Grundlegenden Funktionen einer ArrayList<String> hat ohne ArrayList<> in der Klasse zu verwenden.

Zu implementierende Methoden

Die folgenden Methoden sind in der Klasse zu implementieren. Die Methoden und ihre Beschreibung sind der offiziellen Java documentation zu entnehmen. https://docs.oracle.com/javase/8/docs/api/java/util/ArrayList.html

Achtung! Die Methoden müssen für die Aufgabe ein wenig angepasst werden.

Methode Parameter Rückgabetyp Rückgabewert
add(String n) n: String to be appended void
add(int index, String n) index: index at which the specified String is to be inserted
n: String to be inserted
Boolean true: erfolgreich
false: fehlgeschlagen
addAll(MeineArrayList liste) liste: list wich gets appended void
addAll(int index, MeineArrayList liste) index: index at which to insert the first element
list: list containing Strings to be added to this list
Boolean true: erfolgreich
false: fehlgeschlagen
clear() void
contains(String s) s: String to search Boolean true: the same String exists (s.eaquals()) in the list
false: the String doesn't exists in the list.
get(int index) index: index to return String returns the String from the specifed index
indexOf(String s) s: String to search int Returns the index of the first eaqual String in this list, or -1 if this list does not contain the element.
isEmpty() Boolean Returns true if the list contains no elements.
remove(int index) index: index to remove String removes the specified index and returns the removed String.
set(int index, String s) index: index to replace
s: String to replace with.
Boolean Replaces the String at the specified position in this list with the specified String.
size() int Returns the number of elements in this list.
toArray() String[] Returns an array containing all Strings in this list in proper sequence (from first to last String). The returned Array is a deep copy. This means that if you change a String in the returned Array the String isn't changed in this list.