Though it’s been more than a year Java 8 was launched while writing this article section, but I still find many Developers (like me few weeks earlier) unaware of the power of updated facilities given in Java 8.
Java 8 breakthroughs overview
There are two major Breakthroughs you can consider in Java 8:
Functional Programming: Java has to compete on daily basis with cool kids on the block like node.js, python, scala, etc for rapid development. Since people are in hurry now a days to have a working prototype up and running they don’t want to follow formal nomenclature. Who cares!!! Well Java community was listening to this paradigm shift and they proposed to introduce functional programming in JSR-335. The idea was to introduce following concept:
Lambda Expressions: This is what you call functional Closures. Using Lambda Expressions “You can pass Functionality as argument or code as data”.
Functional Interface: In simple words, it’s an interface with only one abstract method.
Method References: We can pass reference of a method as callback. There are three types of Method References in Java 8.
Streams: It enables you to process data in collections in declarative way same as an SQL statement. Well that’s something new. Furthermore, streams enable you to process collections in multi-core architecture using parallel streams without worrying about multi-threading chores. There has been some observation about performance trade-offs in streams. Consequently, many have gone to an extent of saying your performance will decrease up-to 5 times using Streams. Having said, something new takes time to settle. I am sure next releases will get this optimized and sorted out. As a result, looking at the features, it is only eventual that developers are going to leverage the benefits of these features.
Flow of Tutorial
Ideal flow of this tutorial is:
However some may have different view for sequence of topic one might want to browse, feel free to navigate as per your will!!
In addition, a quick way to grasp these concepts is an Online Video Tutorial for Java 8 which contains all the lectures for Java developers on these concepts. The video tutorial covers all the above concepts and you can have lifetime access of the videos and also view it on Android and iOS. Hope you have fun with this.