Browse Source

forAll-Methode implementiert

T_SS18_List
hertero 3 years ago
parent
commit
9d4d517b09
  1. 9
      SimpleLinkedList/src/solution/SimpleLinkedList.java

9
SimpleLinkedList/src/solution/SimpleLinkedList.java

@ -78,12 +78,11 @@ public class SimpleLinkedList<E> extends AbstractSimpleList<E> {
@Override
public void forAll(ICommand<E> command) {
if (command != null) {
Node<E> aktuellerKnoten = ersteKnoten;
while(aktuellerKnoten != null) {
command.execute(aktuellerKnoten.getPayload());
aktuellerKnoten = aktuellerKnoten.getSuccessor();
Node<E> currentNode = firstNode;
while (currentNode != null) {
command.execute(currentNode.getPayload());
currentNode = currentNode.getSuccessor();
}
}
}
}

Loading…
Cancel
Save