Browse Source

contains-Methode implementiert

vollständige_und_weitere_testate
hertero 3 years ago
committed by chris
parent
commit
768e5f67ba
  1. 11
      SimpleLinkedList/src/solution/SimpleLinkedList.java

11
SimpleLinkedList/src/solution/SimpleLinkedList.java

@ -62,18 +62,17 @@ public class SimpleLinkedList<E> extends AbstractSimpleList<E> {
@Override
public boolean contains(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)) {
if (o.equals(currentNode)) {
return true;
}
return false;
}
@Override

Loading…
Cancel
Save