I've been stuck on this for awhile now. I am trying to remove elements of a set if they make a set criteria. However when iterating when I try to remove the element it fails.
I get the java.util.ConcurrentModificationException
private static void smallerSet(Set<Map<String, Int>> set){
for (Map<String, Integer> map : set){
for (String String : map.keySet()){
if ( true){
set.remove(map);
}
else{
//System.out.println("test");
}
}
}
}
Any advice would be greatly appreciated.