I'm working on something where I have a Collections.synchronizedMap defined.
In one thread A, it will just get the value, and put an updated value so it is not a problem.
In another thread B, it will iterate through the entries and then based on the values of an entry, do some comparisons, and if it matches some condition, it will delete that entry from the map.
My understanding is that a synchronized Map will block access.
But is it possible that thread B gets an entry, then thread A updates the value, and then thread B deletes the value because it matches some condition, but it shouldn't have because of the value thread A updated it to. And what would be the best implementation to work around this?