explode

Brian Goetz brian.goetz at oracle.com
Thu Feb 7 10:16:15 PST 2013


I think the proposed solution there is:
  - example in Javadoc, and/or static helper

static <U> FlatMapper<T,U>
flatMapperToCollection(Mapper<T,Collection<U>> m) {
     (t, sink) -> m.apply(t).forEach(sink);
}

So users can say

   stream.flatMap(flatMapperToCollection(t -> getColl(t)))

and the javadoc can point them to that.

On 2/7/2013 1:12 PM, Tim Peierls wrote:
> On Wed, Feb 6, 2013 at 6:30 PM, Brian Goetz <brian.goetz at oracle.com
> <mailto:brian.goetz at oracle.com>> wrote:
>
>        Stream<U> flatMap(FlatMapper<T, U>)
>        Stream<U> flatMap(Function<T, Stream<U>>)
>
>     That's the new proposal.
>
>     Will be carved in stone in 24h unless there is further discussion :)
>
>
> Still have six hours. :-)
>
> I hate to give up verbose/friendly flatMapToCollection entirely. It's
> not immediately obvious to me how to write it myself, and it feels as
> though it'll come up a lot. Even just an example in javadocs would help.
>
> --tim
>


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