Survey on map/flatMap disambiguation

Brian Goetz brian.goetz at
Thu Mar 14 10:04:47 PDT 2013

The survey is closed, results are here:

The sense of the EG was strongly in favor of disambiguating both map and 
flatMap; several argued that they liked the "less magic" aspect of it, 
and the explicitness of where we go from reference to primitive streams 
and back.

This does create a possibility for performance bugs, where users do:, Integer::sum)

instead of

   stuff.mapToInt(Foo::size).reduce(0, Integer::sum)

Both will now compile, but the former will be boxed and the latter won't 
be.  The previous status quo saved users from themselves in this case.

Will make the following changes: -> {map,mapTo{Int,Long,Double}}
  Stream.flatMap -> {flatMap,flatMapTo{Int,Long,Double}}
  {Int,Long,Double} -> map,mapToObj

On 3/10/2013 7:51 PM, Brian Goetz wrote:
> I've posted a survey for the EG at:
> where people can express their opinion on the issue of flatMap
> disambiguation (see thread entitled "flatMap ambiguity").
> The password has been communicated directly to the EG; contact me if you
> didn't get it.
> Usual survey rules: enter your name with your response, all results will
> be made public after the survey closes.  I'll set a closing time of 6PM
> PT Wednesday of this week.

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