Scala 2.13 迁移指南包含有关如何移植的说明collection.breakOut
:
collection.breakOut
不再存在,使用.view
and.to(Collection)
代替。
概览表中的以下几段有:
描述 旧代码 新代码 自动迁移规则 collection.breakOut
不复存在val xs: List[Int]
= ys.map(f)
(collection.breakOut)
val xs =
ys.iterator.map(f).to(List)
Collection213Upgrade
scala-collection-migration
重写规则使用.iterator
. 两者有什么区别?有理由偏爱其中一个吗?