|
|
@ -43,19 +43,19 @@ public class SimpleLinkedList<E> extends AbstractSimpleList<E> { |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean remove(Object o) { |
|
|
|
if(o == null) { |
|
|
|
if (o == null) { |
|
|
|
return false; |
|
|
|
} |
|
|
|
Node<E> aktuellerKnoten = ersteKnoten; |
|
|
|
while(aktuellerKnoten != null) { |
|
|
|
aktuellerKnoten = aktuellerKnoten.getSuccessor(); |
|
|
|
Node<E> currentNode = firstNode; |
|
|
|
while (currentNode != null) { |
|
|
|
currentNode = currentNode.getSuccessor(); |
|
|
|
} |
|
|
|
if(o.equals(aktuellerKnoten)) { |
|
|
|
aktuellerKnoten.setPayload(null); |
|
|
|
if (o.equals(currentNode)) { |
|
|
|
currentNode.setPayload(null); |
|
|
|
size--; |
|
|
|
aktuellerKnoten = aktuellerKnoten.getPredecessor(); |
|
|
|
currentNode = currentNode.getPredecessor(); |
|
|
|
return true; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
return false; |
|
|
|
} |
|
|
|