Open
Description
reproduction steps
- using Scala?
scala 2.13.2> val xs = collection.mutable.ArrayBuffer(1,2,3)
val xs: scala.collection.mutable.ArrayBuffer[Int] = ArrayBuffer(1, 2, 3)
scala 2.13.2> val it = xs.iterator
val it: Iterator[Int] = <iterator>
scala 2.13.2> it.hasNext
val res0: Boolean = true
scala 2.13.2> xs.clear()
scala 2.13.2> it.hasNext
val res2: Boolean = true
scala 2.13.2> it.next()
val res3: Int = 0
scala 2.13.2> it.to(List)
val res4: List[Int] = List(null, null)
scala 2.13.2> xs.size
val res5: Int = 0
problem
Documentation should tell me not to do that.
It would be nice if the iterator told me there was a problem. It's just using indexes from the view.
See #8154