Where does official documentation say that Java's parallel stream operations use fork/join?

后端 未结 3 619
陌清茗
陌清茗 2020-12-14 17:16

Here\'s my understanding of the Stream framework of Java 8:

  1. Something creates a source Stream
  2. The implementation is responsible for providing a Ba
3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 17:39

    You can check source code of terminal operations on GrepCode. For example, lets take a look at ForEachOp. As you can see evaluateParallel method of ForEachOp creates and invokes ForEachTask object which is derived from CountedCompleter derived from ForkJoinTask.

提交回复
热议问题