Effectively final

Brian Goetz brian.goetz at oracle.com
Mon Aug 15 14:14:11 PDT 2011


> So I think it's better to disappoint some people and educate everyone to
> use reduce:
> int sum = parallelArray.reduce( 0, #{ element, sum ->  sum + element });

Or, more likely:

   int sum = collection.reduce(0, Reducers.INT_SUM);

Remi has it right here.  You can say "all these languages let you do X 
with closures", but all of those idioms have their roots in a 1950s 
programming model where parallelism was science fiction.  Yes, it took 
Java a while to get closures, but adopting a 1950s-era view of closures 
just because we're still catching up is "not the modernization you are 
looking for."



More information about the lambda-dev mailing list