Java 8 release is just a couple of weeks away, scheduled at 18th March 2014, and there is lot of buzz and excitement about this path breaking release in Java community. One of feature, which is synonymous to this release is lambda expressions, which will provide ability to pass behaviours to methods. Prior to Java 8, if you want to pass behaviour to a method, then your only option was Anonymous class, which will take 6 lines of code and most important line, which defines the behaviour is lost in between. Lambda expression replaces anonymous classes and removes all boiler plate, enabling you to write code in functional style, which is some time more readable and expression. This mix of bit of functional and full of object oriented capability is very exciting development in Java eco-system, which will further enable development and growth of parallel third party libraries to take advantage of multi-processor CPUs. Though industry will take its time to adopt Java 8, I don't think any serious Java developer can overlook key features of Java 8 release e.g. lambda expressions, functional interface, stream API, default methods and new Date and Time API. As a developer, I have found that best way to learn and master lambda expression is to try it out, do as many examples of lambda expressions as possible. Since biggest impact of Java 8 release will be on Java Collections framework its best to try examples of Stream API and lambda expression to extract, filter and sort data from Lists and Collections. I have been writing about Java 8 and have shared some useful resources to master Java 8 in past. In this post, I am going to share you 10 most useful ways to use lambda expressions in your code, these examples are simple, short and clear, which will help you to pick lambda expressions quickly.
Read more �
Showing posts with label Lambda expression. Show all posts
Showing posts with label Lambda expression. Show all posts
Wednesday, February 26, 2014
Monday, November 25, 2013
Java 8 Tutorials, Resources, Books and Examples to learn Lambdas, Stream API and Functional Interfaces
While the release of Java 8 is still a few month away, GA is scheduled is in early next year, Java community has already shared some really good tutorial to learn, probably the next big thing in Java world, lambda expressions. While the term "lambda expression" may sound abstract and academic, Java 8 Lambdas can have a big impact on how you program every day. Java 8 is coming up with Lambda expressions, Stream API, Functional interfaces and default methods, which is eagerly waited through out the world. Not surprisingly, I am also started learning Java 8 new features and I am grateful to all these peoples, who has shared wonderful tutorials on lambdas. These are the peoples who have downloaded nightly builds, work through specification and initial draft and created easy to understand Java 8 tutorials and examples. Since I am personally following them, it make a lot of sense for me to share all these resources with me. As a professional Java developer, you will have to learn Java 8 sooner than letter. It's definitely going to have a huge impact on how you use Java Collection framework in your program, especially on high performance applications. Earlier, when I shared some differences between Java and Scala, I had mentioned some cool features of Scala which makes code concise, clear and more readable, Java 8 is bringing parity on that as well. So stay tuned and follow these Java 8 Lambda, Stream API and functional interfaces tutorial to get a feel of, what is going to be biggest change in Java programming language since it's first launch, probably even bigger than Generics from Java 1.5.
Read more �