So I've recently discovered FindBug, but it's making me think I don't know what I'm doing in a couple of places. This is one of them
private Map<String, Object> map = new ConcurrentHashMap<String, Object>();
public void method1(){
synchronized(map){ // FindBug says this is unnecessary
for (String keys: map.keySet()){
...
}
}
}
I thought that I needed to synchronize the iteration, or is this a case of FindBug not being smart enough to realize it's necessary? I just want to make sure!