Collections ConcurrentModificationException

Kellgi

Neues Mitglied
Hallo,
ich bekomme beim durchlaufen der Schleife eine "ConcurrentModificationException" obwohl ich doch meine 'FoundUserNotSearchedYet_helper' gar nicht zu verändern....

Java:
			for (Agent a : FoundUserNotSearchedYet_helper)
			{
				try{
					Agent safeCopyA = a;
					//add new found
					newFound = agent_radar.addAllInRangeSeparate(safeCopyA);
					foundGeneral.addAll(newFound);
					newFound = AgentGrid.findRealNew(foundGeneral, newFound);
					FoundUserNotSearchedYet.addAll(justUser(newFound));
					
					
					//handle a
					UserThatSearched.add(safeCopyA);
					FoundUserNotSearchedYet =    AgentGrid.removeAgent(FoundUserNotSearchedYet, safeCopyA);
					
				}
				catch(ConcurrentModificationException e)
				{
					e.getMessage();
				}
					

			}

vielleicht sieht hier jmd was.
danke
 
Zuletzt bearbeitet von einem Moderator:

njans

Top Contributor
Java:
 FoundUserNotSearchedYet =    AgentGrid.removeAgent(FoundUserNotSearchedYet, safeCopyA);
Daher kommt das. Deine SafeCopy, ist keine Copy. Du referenzierst das nur neu.
 

Kellgi

Neues Mitglied
danke an alle.
die entfernung der erwähnten zeile hat dann auch noch ncht gereicht. hab jetzt einfach n echten Clone der durchiterierten Liste gemacht
 
Ähnliche Java Themen
  Titel Forum Antworten Datum
B Exception in thread "AWT-EventQueue-0" java.util.ConcurrentModificationException Java Basics - Anfänger-Themen 8
temi ConcurrentModificationException Java Basics - Anfänger-Themen 32
C ConcurrentModificationException Java Basics - Anfänger-Themen 3
F Collections ConcurrentModificationException in ArrayList, mehrere Threads Java Basics - Anfänger-Themen 7
S ConcurrentModificationException Java Basics - Anfänger-Themen 4
H ConcurrentModificationException in HashMap Java Basics - Anfänger-Themen 2
Appleleptiker Datentypen ConcurrentModificationException Java Basics - Anfänger-Themen 5
Luk10 ConcurrentModificationException Java Basics - Anfänger-Themen 35
Luk10 ConcurrentModificationException Java Basics - Anfänger-Themen 15
H ConcurrentModificationException Java Basics - Anfänger-Themen 11
K java.util.ConcurrentModificationException problem in der Logik? Quaxli-Tutorial Java Basics - Anfänger-Themen 9
T ConcurrentModificationException bei HashMap Operation Java Basics - Anfänger-Themen 2
E java.util.ConcurrentModificationException Problem Java Basics - Anfänger-Themen 5
F java.util.ConcurrentModificationException Java Basics - Anfänger-Themen 8
S ArrayList ConcurrentModificationException Java Basics - Anfänger-Themen 4
J ConcurrentModificationException finden Java Basics - Anfänger-Themen 2
cowabunga1984 Objek löschen -> ConcurrentModificationException Java Basics - Anfänger-Themen 7
N removeAll und ConcurrentModificationException Java Basics - Anfänger-Themen 2

Ähnliche Java Themen

Neue Themen


Oben