Is it possible to use 'yield' to generate 'Iterator' instead of a list in Scala?

后端 未结 3 1300
渐次进展
渐次进展 2021-01-31 04:06

Is it possible to use yield as an iterator without evaluation of every value?

It is a common task when it is easy to implement complex list generation, and then you need

3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-31 04:33

    Use views if you want lazy evaluation, see Views.

    The Scala 2.8 Collections API is a fantastic read if you're going to use the Scala collections a lot.

提交回复
热议问题