Pls help me with this problem. I have Graph represent by Structure HashMap> graf; and i need to go throught that hashmap and set and remove some edges. How can i do that ? code give me this exception
Exception in thread "main" java.util.ConcurrentModificationException
at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
at java.util.HashMap$KeyIterator.next(Unknown Source)
public String vratCestu() {
String vrat = "";
for(String s: this.graf.keySet()){
if (this.graf.get(s).size() != 0)
for(String k : this.graf.get(s)){
this.graf.get(s).remove(k);
this.graf.get(k).remove(s);
vrat += k + "; ";
}
}
return vrat;
}