Scala 2.13 migration guide contains a note regarding how to port collection.breakOut
:
collection.breakOut
no longer exists, use.view
and.to(Collection)
instead.
and few paragraphs below in a overview table there is:
Description Old Code New Code Automatic Migration Rule collection.breakOut
no longer existsval xs: List[Int]
= ys.map(f)
(collection.breakOut)
val xs =
ys.iterator.map(f).to(List)
Collection213Upgrade
The scala-collection-migration
rewrite rule uses .iterator
. What is the difference between the two? Is there a reason to prefer one to the other?