Throw IllegalStateException from MapBuilder iterator.remove() #KT-47419
This commit is contained in:
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 hasNext(): Boolean = index < map.length
|
||||||
|
|
||||||
fun remove() {
|
fun remove() {
|
||||||
|
check(lastIndex != -1) { "Call next() before removing element from the iterator." }
|
||||||
map.checkIsMutable()
|
map.checkIsMutable()
|
||||||
map.removeKeyAt(lastIndex)
|
map.removeKeyAt(lastIndex)
|
||||||
lastIndex = -1
|
lastIndex = -1
|
||||||
|
|||||||
Reference in New Issue
Block a user