Throw IllegalStateException from MapBuilder iterator.remove() #KT-47419

This commit is contained in:
Abduqodiri Qurbonzoda
2021-06-23 19:37:59 +03:00
committed by Space
parent 1006eb0945
commit aabc00f53f
@@ -459,6 +459,7 @@ internal class MapBuilder<K, V> private constructor(
fun hasNext(): Boolean = index < map.length
fun remove() {
check(lastIndex != -1) { "Call next() before removing element from the iterator." }
map.checkIsMutable()
map.removeKeyAt(lastIndex)
lastIndex = -1