|
|
@ -24,19 +24,17 @@ public class SimpleLinkedList<E> extends AbstractSimpleList<E> { |
|
|
|
if (e == null) { |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
Node<E> neuerKnoten = new Node<>(e); |
|
|
|
|
|
|
|
if (ersteKnoten == null) { |
|
|
|
ersteKnoten = neuerKnoten; |
|
|
|
} |
|
|
|
else { |
|
|
|
Node<E> aktuellerKnoten = ersteKnoten; |
|
|
|
while(aktuellerKnoten != null) { |
|
|
|
aktuellerKnoten = aktuellerKnoten.getSuccessor(); |
|
|
|
Node<E> newNode = new Node<>(e); |
|
|
|
|
|
|
|
if (firstNode == null) { |
|
|
|
firstNode = newNode; |
|
|
|
} else { |
|
|
|
Node<E> currentNode = firstNode; |
|
|
|
while (currentNode != null) { |
|
|
|
currentNode = currentNode.getSuccessor(); |
|
|
|
} |
|
|
|
aktuellerKnoten.setSuccessor(neuerKnoten); |
|
|
|
aktuellerKnoten.setPredecessor(aktuellerKnoten); |
|
|
|
|
|
|
|
currentNode.setSuccessor(newNode); |
|
|
|
currentNode.setPredecessor(currentNode); |
|
|
|
} |
|
|
|
} |
|
|
|
size++; |
|
|
|