Добрый день. Подскажите, как пройтись по HashMap и внести изменения в мап?
Выбрасывает исключение java.util.ConcurrentModificationException
Чекнул в api.
Note that this exception does not always indicate that an object has been concurrently modified by a different thread. If a single thread issues a sequence of method invocations that violates the contract of an object, the object may throw this exception. For example, if a thread modifies a collection directly while it is iterating over the collection with a fail-fast iterator, the iterator will throw this exception.
В этот момент поток садится в монитор, поэтому проблема не в потоке. Проблема в попытке изменить мап(удалить элементы) во время итерации