我有监控 foreach 方法进度的代码,但需要能够检测 foreach 循环是否会并行发生以选择适当的进度跟踪算法。花时间跟踪一个错误并将其隔离为:
scala> Vector(1,2,3).iterator.isParallel
res11: Boolean = false
scala> Vector(1,2,3).isParallel
res12: Boolean = false
scala> Vector(1,2,3).par.isParallel
res13: Boolean = true
...
scala> Vector(1,2,3).par.splitter.isParallel
res13: Boolean = false
scala> Vector(1,2,3).par.iterator.isParallel
res14: Boolean = false
这是一个错误还是我误解了这个功能?