<div dir="auto"><div dir="auto">Think about `flatMap` (which filter is a special case of), this is one-to-many function that can also return 1 or 0 elements for each input. So it makes sense to include 0 as "many".</div><div dir="auto"><br></div><div dir="auto">Filter isn't many-to-... At all, at no point it collapses a subsequence of elements, it only works on one element at a time </div><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Sun, 7 Apr 2024, 19:31 Ernie Rael, <<a href="mailto:errael@raelity.com">errael@raelity.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>
<div>
<div>On 24/04/07 9:11 AM, Viktor Klang
wrote:<br>
</div>
<blockquote type="cite">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Hi Ernie,</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
"Many" in this case refers to "N", which is "0 ... N", </div>
</blockquote>
OK, I was wondering about "many" including "0".<br>
<blockquote type="cite">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">so
I'd say while it is techincally correct as-is, perhaps more
precise would be to say "1-to-0..1" gatherer, since for every
element in, there is 0 or 1 element out.</div>
</blockquote>
I see.<br>
<blockquote type="cite">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Many-to-one would be 0..N -> 1, which means that an empty
input would </div>
</blockquote>
"could" not "would"?<br>
<blockquote type="cite">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">yield
a single output.</div>
</blockquote>
<p>Out of curiosity, is either correct technically?</p>
<p><br>
</p>
<p>Other than at initialization or finish, is it possible to have
an "empty" input?</p>
<p><br>
</p>
<p>-ernie<br>
</p>
<blockquote type="cite">
<div style="font-family:Aptos,Aptos_EmbeddedFont,Aptos_MSFontService,Calibri,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div id="m_-5282729504551143593Signature" style="color:inherit;background-color:inherit">
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Cheers,<br>
√</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<br>
</div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<b><br>
</b></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
<b>Viktor Klang</b></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif;font-size:12pt;color:rgb(0,0,0)">
Software Architect, Java Platform Group<br>
Oracle</div>
</div>
<hr style="display:inline-block;width:98%">
<div id="m_-5282729504551143593divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b>
core-libs-dev <a href="mailto:core-libs-dev-retn@openjdk.org" target="_blank" rel="noreferrer"><core-libs-dev-retn@openjdk.org></a> on behalf
of Ernie Rael <a href="mailto:errael@raelity.com" target="_blank" rel="noreferrer"><errael@raelity.com></a><br>
<b>Sent:</b> Sunday, 7 April 2024 18:06<br>
<b>To:</b> <a href="mailto:core-libs-dev@openjdk.org" target="_blank" rel="noreferrer">core-libs-dev@openjdk.org</a>
<a href="mailto:core-libs-dev@openjdk.org" target="_blank" rel="noreferrer"><core-libs-dev@openjdk.org></a><br>
<b>Subject:</b> JEP 473: Stream Gatherers (Second Preview)</font>
<div> </div>
</div>
<div>
<p>This is about what might be a minor doc issue.<br>
</p>
<p>In <a href="https://openjdk.org/jeps/473" target="_blank" rel="noreferrer">https://openjdk.org/jeps/473</a>
it says<br>
</p>
<blockquote type="cite">As another example, <code>Stream::filter</code>
takes a predicate that determines whether an input element
should be passed downstream; this is simply a stateless
one-to-many gatherer.</blockquote>
Shouldn't this be "many-to-one"?
<p>-ernie</p>
</div>
</blockquote>
<p><br>
</p>
</div>
</blockquote></div></div>