<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <div class="moz-cite-prefix">
      <blockquote type="cite">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 </blockquote>
      I was conflating the behavior of a specific intermediate operation
      with a black box view of an operation. Looking at an operation as
      a black box is useless (maybe mildly interesting at most). The
      description of filter as "one-to-many" threw me off balance (this
      is the first time I read the gatherer spec in detail, and I've
      only looked at streams on an as need basis, it took this long
      having brief exposures till I felt ready); but as was said, the
      precise description of filter is "1-to-0..1".</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">I'm still curious about the idea of an
      "empty" input?. Seems like "many" on the left side is never "0",
      in particular something like: "1..N-to-SomeRange"</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">Thanks to all,<br>
    </div>
    <div class="moz-cite-prefix">-ernie</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">PS. Looking at flatMap (and mapMulti)
      was a good exercise.<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 24/04/07 11:24 AM, Holo The Sage
      Wolf wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAKswmE59qfGcTHsd4DK2+jSXrXJ58UdsVrFhCr5c7Fh9b2S8tA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <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"
              moz-do-not-send="true" class="moz-txt-link-freetext">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">
            <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"
                      moz-do-not-send="true"><core-libs-dev-retn@openjdk.org></a>
                    on behalf of Ernie Rael <a
                      href="mailto:errael@raelity.com" target="_blank"
                      rel="noreferrer" moz-do-not-send="true"><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"
                      moz-do-not-send="true"
                      class="moz-txt-link-freetext">core-libs-dev@openjdk.org</a>
                    <a href="mailto:core-libs-dev@openjdk.org"
                      target="_blank" rel="noreferrer"
                      moz-do-not-send="true"><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"
                      moz-do-not-send="true"
                      class="moz-txt-link-freetext">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>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>