Two years ago, I blogged about parallel for each construct using a very early version of lambda prototype compiler. At that time, Data Parallelism was already available in C# TPL, but Java designers were hard at work in bringing this idiom to Java.
Lambda expressions support in Java 8 is here for everyone to give it a spin. Functional touch to Collections library makes it a breeze to program in Java. you get this one-liner using Java 8 Stream API.
There are more such one-liners you can think of using parallel constructs in Java 8. Here is another teaser, send an email blast to all customers.
Streams API brings several of the LINQ as well as PLINQ awesomeness to Java Collections library. Here is an adhoc query over a collection using the new Streams API.
Check it out here for more one-liners. You may want to checkout this article that compares LINQ with Java Streams API. While, there are constraints with the Java Streams proposal, it hits the right balance and there is a pedagogical value to it as well, keeping majority Java developers happy.
Possibly Related Posts:
- Java 8 gearing up for release, why Java 8 will be a top contender for Java.next languages in 2014?
- Configuring chunk size in Apache HttpClient 4.3.x
- Java 8 – This ain’t your grandpa’s Java
- Functional Programming Principles in Scala video lectures from coursera.org
- Implementing a light weight web service trigger in Flux