I have a HashMap:
public static Map<String, Set<String>> adjMap = new HashMap<String, Set<String>>();
adjMap.put(title, new HashSet<String>());
adjMap.get(title).add(cutTitle(graphLink));
Now I want do delete all entries from the values (HashSet), which does not contains as a key.
Here is my code so far:
for(String s: adjMap.keySet()){
    for(Set<String> s1: adjMap.values()){
        for(String s2: s1){
            if(!s.contains(s2)){
                s1.remove(s2);
            }
        }
    }
}
But I get an exception:
Exception in thread "main" java.util.ConcurrentModificationException
 
     
     
     
    