Compare commits

..

No commits in common. "7d1af4bd854bbf917c29d3b8b35eac71fa5dbcdb" and "ff28fcb09946a000c9efd8f81e069c90234dde89" have entirely different histories.

2 changed files with 1 additions and 47 deletions

View File

@ -8,19 +8,6 @@ package part1.aufg6;
*/
public class Anwendung {
public static void main(String[] args){
LinkedList myList = new LinkedList();
myList.add("a");
myList.add("b");
myList.add("c");
myList.add("d");
// myList.add("e");
// myList.add("f");
myList.delete("a");
myList.delete("b");
myList.delete("c");
myList.delete("d");
myList.printALL();
System.out.println("Moin");
}
}

View File

@ -33,9 +33,6 @@ public class LinkedList<T>{
}
public void printALL(){ // correct???
if (anchor==null){
return;
}
Cell<T> next = anchor.next;
System.out.println(anchor.data);
@ -65,34 +62,4 @@ public class LinkedList<T>{
next = next.next; // must happen at end of loop
}
}
public void delete(T value){
System.out.println("Removing " + '"' + value + '"');
if (anchor == null)return;
if (anchor.data == value){
anchor = anchor.next;
return;
}
if ((anchor.next != null) && (anchor.next.data == value)){
anchor.next = anchor.next.next;
}
var cell = anchor.next;
while (cell != null && cell.next != null){
if (cell.next.data == value) {
if (cell.next.next != null) {
cell.next = cell.next.next;
return;
}
}
if ((cell.next.next == null) && (cell.next.data == value)){
cell.next = null;
return;
}
cell = cell.next;
}
}
}