606 |
|
* in exceptions or errors, possibly including ClassCastException. |
607 |
|
* |
608 |
|
* @param tasks the collection of tasks |
609 |
+ |
* @return the tasks argument, to simplify usage |
610 |
|
* @throws NullPointerException if tasks or any element are null |
611 |
|
* @throws RuntimeException or Error if any task did so |
612 |
|
*/ |
613 |
< |
public static void invokeAll(Collection<? extends ForkJoinTask<?>> tasks) { |
613 |
> |
public static <T extends ForkJoinTask<?>> Collection<T> invokeAll(Collection<T> tasks) { |
614 |
|
if (!(tasks instanceof List<?>)) { |
615 |
|
invokeAll(tasks.toArray(new ForkJoinTask<?>[tasks.size()])); |
616 |
< |
return; |
616 |
> |
return tasks; |
617 |
|
} |
618 |
|
@SuppressWarnings("unchecked") |
619 |
|
List<? extends ForkJoinTask<?>> ts = |
648 |
|
} |
649 |
|
if (ex != null) |
650 |
|
rethrowException(ex); |
651 |
+ |
return tasks; |
652 |
|
} |
653 |
|
|
654 |
|
/** |