I'm receiving the exception named concurrent modification.
let me know the code for given a map to compare given value with a map value and to remove the entries from the map which are having less value than a given value

11-14-2011, 01:33 PM

JosAH

Re: Regarding map ina java

You are trying to remove an entry from your map 'behind the back' of the iterator, hence the Exception. A map keeps a 'modifiation counter' and increments it each time the map is modified. When an Iterator is instantiated it registers this modification count. Each time an Iterator has to do something it compares the map's modification counter and its own version; when they differ the map was modified 'behind the back' of the Iterator and it throws an Exception. Read the API for the Iterator interface: an Iterator can (optionally) remove an entry from the Collection it iterates over ...