Remark on the StructuredTaskScope API of Java 25
Alan Bateman
alan.bateman at oracle.com
Thu Sep 25 13:50:16 UTC 2025
On 24/09/2025 16:37, Remi Forax wrote:
> :
>
> - allSuccessfulOrThrow() should return a Joiner<T, List<Subtask<T>>>, so the result is a List and not a stream.
> In terms of implementation, in result(), the code should be
> return Collections.unmodifiableList(subtasks);
>
Can you say more on this? Right now, preferring a stream works well. For
a Joiner returned by allSuccessfulOrThrow it makes it easy to use
join().map(Subtask::get) or other mapping function. Add .toList() to get
a list. When using a Joiner created with allUntil then you may have to
use a collector that partitions the subtasks into those that were
successfull and those that didn't complete successfully.
-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20250925/79a7dcc0/attachment-0001.htm>
More information about the loom-dev
mailing list