This question may be a little old, but since I think the βrightβ answer here is only one way that can lead to some problems that are hidden in the future. Even if there is a slight controversy , checked exceptions exist for some reason.
The most elegant way, in my opinion, you can find here, Misha here. Cumulative runtime exceptions in Java 8 threads by simply performing actions in the "futures". Thus, you can start all working parts and collect broken Exceptions as one. Otherwise, you can collect them all on the list and process them later.
A similar approach comes from Benji Weber . He suggests creating his own type for collecting workers and non-working parts.
Depending on what you really want to achieve, a simple mapping between input values ββand Output values. Values ββmay also work for you.
If you do not like any of these methods, consider using (depending on the Original Exception) at least your own exception.
Mariano Oct 19 '15 at 15:51 2015-10-19 15:51
source share