Modulo the names, seems reasonable. Don&#39;t know why the extra static method, but it doesn&#39;t wreck things for me.<br><br><div class="gmail_quote">On Fri, Feb 8, 2013 at 10:47 AM, Brian Goetz <span dir="ltr">&lt;<a href="mailto:brian.goetz@oracle.com" target="_blank">brian.goetz@oracle.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">OK, just to put it all down on &quot;paper&quot; where flatMap landed...are we OK with this?<br>
<br>
java.util.stream.FlatMapper:<br>
<br>
public interface FlatMapper&lt;T, U&gt; {<br>
    void explodeInto(T element, Consumer&lt;U&gt; sink);<br>
<br>
    interface ToInt&lt;T&gt; {<br>
        void explodeInto(T element, IntConsumer sink);<br>
    }<br>
<br>
    interface ToLong&lt;T&gt; {<br>
        void explodeInto(T element, LongConsumer sink);<br>
    }<br>
<br>
    interface ToDouble&lt;T&gt; {<br>
        void explodeInto(T element, DoubleConsumer sink);<br>
    }<br>
<br>
    interface OfIntToInt {<br>
        void explodeInto(int element, IntConsumer sink);<br>
    }<br>
<br>
    interface OfLongToLong {<br>
        void explodeInto(long element, LongConsumer sink);<br>
    }<br>
<br>
    interface OfDoubleToDouble {<br>
        void explodeInto(double element, DoubleConsumer sink);<br>
    }<br>
}<br>
<br>
In Stream:<br>
<br>
    &lt;R&gt; Stream&lt;R&gt; flatMap(Function&lt;T, Stream&lt;? extends R&gt;&gt; mapper);<br>
<br>
    &lt;R&gt; Stream&lt;R&gt; flatMap(FlatMapper&lt;? super T, R&gt; mapper);<br>
<br>
    IntStream flatMap(FlatMapper.ToInt&lt;? super T&gt; mapper);<br>
    LongStream flatMap(FlatMapper.ToLong&lt;? super T&gt; mapper);<br>
    DoubleStream flatMap(FlatMapper.ToDouble&lt;? super T&gt; mapper);<br>
<br>
In IntStream (similar for {Double,Long}Stream):<br>
<br>
    IntStream flatMap(IntFunction&lt;? extends IntStream&gt; mapper);<br>
    IntStream flatMap(FlatMapper.OfIntToInt mapper);<br>
<br>
<br>
And Remi wants one more static helper method in FlatMap:<div class="im"><br>
<br>
 public static &lt;T, U&gt; FlatMapper&lt;T, U&gt;<br>
 explodeCollection(Function&lt;? super T, ? extends Collection&lt;? extends U&gt;&gt; function)<br>
<br>
<br></div>
I think this wraps up the explosive section of our program?<div class="im"><br>
<br>
<br>
On 2/6/2013 7:05 PM, Kevin Bourrillion wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On Wed, Feb 6, 2013 at 3:30 PM, Brian Goetz &lt;<a href="mailto:brian.goetz@oracle.com" target="_blank">brian.goetz@oracle.com</a><br></div><div><div class="h5">
&lt;mailto:<a href="mailto:brian.goetz@oracle.com" target="_blank">brian.goetz@oracle.com</a><u></u>&gt;&gt; wrote:<br>
<br>
       Stream&lt;U&gt; flatMap(FlatMapper&lt;T, U&gt;)<br>
<br>
       Stream&lt;U&gt; flatMap(Function&lt;T, Stream&lt;U&gt;&gt;)<br>
<br>
<br>
To make sure I understand: would these two behave identically? Would<br>
they imaginably perform comparably?<br>
<br>
     foos.stream().flatMap((t, consumer) -&gt;<br>
t.somethingThatGivesAStream().<u></u>forEach(consumer))<br>
     foos.stream().flatMap(t -&gt; t.somethingThatGivesAStream())<br>
<br>
Second question, why &quot;FlatMapper.OfInt&quot; here, but &quot;IntSupplier&quot; etc.<br>
elsewhere?<br>
<br>
--<br>
Kevin Bourrillion | Java Librarian | Google, Inc. |<a href="mailto:kevinb@google.com" target="_blank">kevinb@google.com</a><br></div></div>
&lt;mailto:<a href="mailto:kevinb@google.com" target="_blank">kevinb@google.com</a>&gt;<br>
</blockquote>
</blockquote></div><br>