I'm facing the following problem:
I do interate over a ConcurrentHashMap with the help of a RecursiveAction for dividing and conquering the map.
The problem is that I need to return the first result found for a specific criteria or if nothing is found I need to return null when all "split-tasks" are done.
For now (due to the fact that I'm using RecursiveAction instead of RecursiveTask) I'm just able to call a method and do "return;" when a task found a match but thats smells very bad.
All solutions I tried with implementing a RecursiveTask needed to go through the whole map (doing all splits) until I could return a value.
Is there any possibility to return a given result and cancel the task to prevend furthing processing using a RecursiveTask?
Perhaps this old SO answer will help. It's a form of "short circuit" and you need to do it all yourself. Or you can use a package from another.