# Why can't the Iterator work correctly?

**URL:** <https://users.scala-lang.org/t/why-cant-the-iterator-work-correctly/3251>\
**Category:** Question\
**Created:** [September 13, 2018, 12:50pm UTC](https://users.scala-lang.org/t/why-cant-the-iterator-work-correctly/3251 "2018-09-13T12:50:59Z")\
**Posts on this page:** 1\
**Showing post:** 18

<div class="post-metadata">

**Author:** ![hmf](https://users.scala-lang.org/user_avatar/users.scala-lang.org/hmf/32/426_2.png) [@hmf](https://users.scala-lang.org/u/hmf)\
**Post date:** [September 14, 2018, 9:07am UTC](https://users.scala-lang.org/t/why-cant-the-iterator-work-correctly/3251/18 "2018-09-14T09:07:15Z")

</div>

> [@MikuChaser](#):
>
> I think Martin Odersky may not want to create a lazy map method. Is it a bug?

No it is not a bug. For an explanation of why, look at:

> [@Why is my implementation of Iterable not lazy](https://users.scala-lang.org/t/why-is-my-implementation-of-iterable-not-lazy/2744):
>
> I am implementing a wrapper that manages iterators within it. Essentially I keep iterators in the wrapper that represent columns of data. While testing I found that my wrapper is not lazy. So I made this very simple test: val counter1 = Stream.from(1).toIterable // No need to call toIterable val r1 = counter1.map( \_ \* 2).take(25).toList // terminates println(r1) The infinite stream above can be processed lazily. So now I implement my own Iterable and expect it to behave lazily …

Its seems this will change in 2.13 and map should retain its laziness.

---

_[View the full topic](https://users.scala-lang.org/t/why-cant-the-iterator-work-correctly/3251)._
