We can submit two types of tasks to forkJoinPool. one is RecursiveAction and other is RecursiveTask.
What is the difference between both of them?
From the first lines of their respective Javadocs:
- [
 RecursiveTaskis] A recursive result-bearing ForkJoinTask.- [
 RecursiveActionis] A recursive resultless ForkJoinTask.
Although technically, RecursiveAction does return a value, it's just always null, because it's a ForkJoinTask<Void>, and that's the only possible value of Void.
They are alike except RecursiveTask returns a result while RecursiveAction has no return value. 
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With