Calling replaceAll() on the mutable builder of a PersistentMap throws a ConcurrentModificationException.
Reproduction
To reproduce:
val pmap = persistentMapOf("a" to 1, "b" to 2)
val mmap = pmap.builder()
mmap.replaceAll { _, u -> u + 1 } // throws ConcurrentModificationException
mmap.build()
What I expected
A persistent map with the mapping "a" to 2, "b" to 3.
What I got
An exception:
java.util.ConcurrentModificationException
at kotlinx.collections.immutable.implementations.persistentOrderedMap.PersistentOrderedMapBuilderLinksIterator.checkForComodification(PersistentOrderedMapBuilderContentIterators.kt:57)
at kotlinx.collections.immutable.implementations.persistentOrderedMap.PersistentOrderedMapBuilderLinksIterator.next(PersistentOrderedMapBuilderContentIterators.kt:26)
at kotlinx.collections.immutable.implementations.persistentOrderedMap.PersistentOrderedMapBuilderEntriesIterator.next(PersistentOrderedMapBuilderContentIterators.kt:69)
at kotlinx.collections.immutable.implementations.persistentOrderedMap.PersistentOrderedMapBuilderEntriesIterator.next(PersistentOrderedMapBuilderContentIterators.kt:61)
at java.util.Map.replaceAll(Map.java:675)
Calling
replaceAll()on the mutable builder of aPersistentMapthrows aConcurrentModificationException.Reproduction
To reproduce:
What I expected
A persistent map with the mapping
"a" to 2, "b" to 3.What I got
An exception: