diff --git a/src/de/teamteamteam/spacescooter/datastructure/ConcurrentLinkedList.java b/src/de/teamteamteam/spacescooter/datastructure/ConcurrentLinkedList.java index 760b65d..9a8b721 100644 --- a/src/de/teamteamteam/spacescooter/datastructure/ConcurrentLinkedList.java +++ b/src/de/teamteamteam/spacescooter/datastructure/ConcurrentLinkedList.java @@ -43,13 +43,13 @@ public class ConcurrentLinkedList { * Remove an element from the list. */ public void remove(T element) { - ConcurrentIterator iter = this.iterator(); - while (iter.hasNext()) { - T e = iter.next(); - if (e.equals(element)) { - iter.remove(); - return; - } + ConcurrentLinkedListNode currentNode = this.head; + while(element.equals(currentNode.getValue()) == false && currentNode.hasNext()) { + currentNode = currentNode.next(); + } + if(currentNode.getValue().equals(element)) { + currentNode.setValue(null); + return; } }