Re: Report: Will Java 8′s Lambda Change The Face of The World?

Olexandr Demura oleksander.demura at gmail.com
Tue Nov 6 23:57:21 PST 2012


On the "The new syntax is nice, but not for everyone" part.
1. `map` and `reduce` can be combined into one `fold`, but your code
example shows it would be clumsier.

Streams.stream(myCollection)
    .map(product -> product.getUnitPrice() * product.getQuantity())
    .reduce(0.0, (subTotal, price) -> subTotal + price)

vs

products.stream().fold(
        () -> 0.0,        (subTotal, product) -> subTotal +
product.getUnitPrice() * product.getQuantity(),        (subTotal1,
subTotal2) -> subTotal1 + subTotal2 /* not used if sequential */);

2. Current documentation suggests stream methods should not be on
collection interfaces to not bloat them since there is no single
stream implementation.

e.g. products.stream() vs products.parallel()

3. May be they need not implicit parameters but primitive operation references?

3.1. java is explicit language (except `+` for String). `java` in IPA
close to 'explicit' in several Slavic languages :)

3.2. when parameter is not needed method references `::` can be used.



2012/11/6 François Sarradin <fsarradin at xebia.fr>

> Hi,
>
> I know that you are looking for feedback. So during October, I
> organized a presentation around the JSR335 at my company: Xebia
> France. More precisely, it was an interactive session with a
> presentation, some live coding and debates around the code, and a
> retrospective. The audience was asked the impact of the Lambda Project
> on the Java community and Java projects would probably be. I have
> reported what has been said during my presentation on the blog of my
> company:
> http://blog.xebia.com/2012/11/05/report-will-java-8s-lambda-change-the-face-of-the-world/
>
> Regards,
>
> François Sarradin
> Xebia IT Architects
> http://www.xebia.fr
> http://blog.xebia.fr
>
>


More information about the lambda-dev mailing list