ConcurrentModificationException occurs when a Collection is modified structurally while an iterator is already traversing the Collection. Taking the example of a HashMap,while iterating through the entries of a HashMap, if the internal structure of the HashMap is changed by either adding an element to it or removing an element from it, a ConcurrentModificationException is caused. What happens internally? HashMap maintains an integer variable called modCount. This modCount is nothing but the count of times the HashMap has been modified structurally. If we add an element to the HashMap, the modCount increases. Similarly, if we remove an element from the HashMap, the modCount increases. Interestingly, when we just update an entry, there isn't any change to the modCount. This is because update to an element does not change the internal structure of the HashMap. When we create an iterator for the Entry table of the HashMap, an expectedCount variable is created which is s...