Whither extension methods?

Joshua Bloch jjb at google.com
Mon Dec 14 23:46:38 PST 2009


Doug Lea sent this a couple of days ago, and I think it deserves our
consideration:

I confess to being a little confused about the rationale for extension
> methods.


> Suppose we have a Map, and want to some sort of apply-to-each-value
> operation. The only reasonable way to do this in parallel is to somehow
> splitthe work. But Map has no public methods allowing you to do this -- you
> can only get an iterator, which is inherently sequential. Now, if we
> could get at the representations, then we could actually do splits for most
> java.util maps (at least for the most common ones -- HashMaps, TreeMaps). So
> the only way I know for these to be bolted on is to introduce new interfaces
> that each of the these existing classes could be changed to implement. Or am
> I missing something?


> You might want to read Guy Steele's nice talk on related issues at
> http://groups.csail.mit.edu/mac/users/gjs/6.945/readings/MITApril2009Steele.pdf


> -Doug


More information about the lambda-dev mailing list