The following code doesn’t work with
val a = 1.to(10).toIterator
The general expectation on any iterator is that first one should give 10 items but the next one should be empty. The List’s toIterator works as expected though
val a = 1.to(10).toList.toIterator
Apparently the bug is because overriding the take and drop in the
Elements in here https://github.com/scala/scala/blob/2.12.x/src/library/scala/collection/IndexedSeqLike.scala
We either should not implement Iterator for Elements or not override take/drop/slice in it.
Or is it intentionally behaving that way?