<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<div class="moz-cite-prefix">On 25/09/2025 21:46, <a class="moz-txt-link-abbreviated" href="mailto:forax@univ-mlv.fr">forax@univ-mlv.fr</a>
wrote:<br>
</div>
<blockquote type="cite" cite="mid:2087574876.55745.1758833190197.JavaMail.zimbra@univ-eiffel.fr">
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000">
<div><br>
</div>
<div><br>
</div>
<hr id="zwchr" data-marker="__DIVIDER__">
<div data-marker="__HEADERS__">
<blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From:
</b>"Alan Bateman" <a class="moz-txt-link-rfc2396E" href="mailto:alan.bateman@oracle.com"><alan.bateman@oracle.com></a><br>
<b>To: </b>"Remi Forax" <a class="moz-txt-link-rfc2396E" href="mailto:forax@univ-mlv.fr"><forax@univ-mlv.fr></a>,
"loom-dev" <a class="moz-txt-link-rfc2396E" href="mailto:loom-dev@openjdk.java.net"><loom-dev@openjdk.java.net></a><br>
<b>Sent: </b>Thursday, September 25, 2025 3:50:16 PM<br>
<b>Subject: </b>Re: Remark on the StructuredTaskScope API
of Java 25<br>
</blockquote>
</div>
<div data-marker="__QUOTED_TEXT__">
<blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;">
<div class="moz-cite-prefix">On 24/09/2025 16:37, Remi Forax
wrote:<br>
</div>
<blockquote cite="mid:715342229.35882407.1758728261503.JavaMail.zimbra@univ-eiffel.fr">
<pre class="moz-quote-pre">:
- 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);
</pre>
</blockquote>
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. </blockquote>
<div><br>
</div>
<div>A collection is more powerful than a Stream, you can
always do more with a List than with a Stream</div>
<div>(like indexed access).</div>
<div><br data-mce-bogus="1">
</div>
<div>Yes, you can always call toList() on a stream, but you
are asking to duplicate all the elements,</div>
<div>here stream.toList() is semantically equivalent to a call
to List.copyOf(), so it's slow if you have quite a lot of
elements.</div>
<div><br data-mce-bogus="1">
</div>
<div>So yes, it might be convenient for some use cases to
return a stream than to call .stream() on the returned List,</div>
<div>but you are trading convenience for performance.</div>
</div>
</div>
</blockquote>
<br>
I don't think this is right argument to change it to return List.
However, another angle is that users might assume the stream is
lazily populated and that results can be consumed before join
completes. For this Joiner, join is meant to wait until all subtasks
complete or any subtask fails. So while returning a Stream is much
more flexible, it may indeed be better to return a List<T>.<br>
<br>
-Alan<br>
<br>
</body>
</html>