Scala的并行集合是否可以保证订购? [英] Will Scala's parallel collections guarantee ordering?
本文介绍了Scala的并行集合是否可以保证订购?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有这个:
val a = Array(...)
我写
a.par.map(e => someFunc(e))
生成的集合将与非并行集合的顺序相同吗?
Will the resulting collection be in the same order as the non-parallel collection?
推荐答案
是的,但是函数本身的执行没有任何特定的顺序.
Yes, but the function itself is executed without any particular order.
List(1,2,3).par foreach print // could print out 213
这篇关于Scala的并行集合是否可以保证订购?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文