FlatMapper

Brian Goetz brian.goetz at oracle.com
Tue Feb 12 10:57:56 PST 2013


Since the name doesn't appear in implementations often, we can use a 
more descriptive name, even if it is long, such as

   mapAndFlattenInto

Would that be better?

On 2/12/2013 1:49 PM, Joe Bowbeer wrote:
> A verb that had some relation to "flat" would be nice - instead of
> explode, which doesn't.
>
> flatten
> extrude
> ??
>
> On Feb 12, 2013 10:42 AM, "Brian Goetz" <brian.goetz at oracle.com
> <mailto:brian.goetz at oracle.com>> wrote:
>
>     Here's where things have currently landed with FlatMapper -- this is
>     a type in java.util.stream, with nested specializations.
>
>     Full bikeshed season is now open.  Are we OK with the name
>     explodeInto()?  Is this general enough to join the ranks of Function
>     and Supplier as top-level types in java.util.function?
>
>     @FunctionalInterface
>     public interface FlatMapper<T, U> {
>          void explodeInto(T element, Consumer<U> sink);
>
>          @FunctionalInterface
>          interface ToInt<T> {
>              void explodeInto(T element, IntConsumer sink);
>          }
>
>          @FunctionalInterface
>          interface ToLong<T> {
>              void explodeInto(T element, LongConsumer sink);
>          }
>
>          @FunctionalInterface
>          interface ToDouble<T> {
>              void explodeInto(T element, DoubleConsumer sink);
>          }
>
>          @FunctionalInterface
>          interface OfIntToInt {
>              void explodeInto(int element, IntConsumer sink);
>          }
>
>          @FunctionalInterface
>          interface OfLongToLong {
>              void explodeInto(long element, LongConsumer sink);
>          }
>
>          @FunctionalInterface
>          interface OfDoubleToDouble {
>              void explodeInto(double element, DoubleConsumer sink);
>          }
>     }
>


More information about the lambda-libs-spec-experts mailing list