Engineering Full Stack Apps with Java and JavaScript
Java is one of the most popular programming languages. However, recently many other programming languages have come and some of them even running on top of the Java Virtual Machine (JVM). Many of these languages support newer programming practices like functional programming and comes with a bunch of out of the box functionalities that abstract away most of the low level details from the programmer.
Java 8 is a response to these programming languages and features. Java 8 has introduced many new features like the functional programming support, behavior parameterization, lambdas, streams etc. that embrace the functional programming style and abstracts away low level details from the programmer. It has also introduced many improvements to existing APIs and have also introduced few alternate APIs.
Some of the new features and improvements in Java 8 are listed below:
Functional programming style
Functional interfaces
Improved interfaces with default and static methods.
Lambda expressions
Out of the box interfaces for reuse.
Behavior parameterization
New Date and Time API similar to popular JODA time
Internal iterations through the new forEach loop
Streams with pipeline model
Out of the box parallelization
Lazy initialization of collections
Less verbose code
Better scripting support with Nashorn Java script engine
Improved type inference
Interface Unlocking
To do many improvements still keeping backward compatibility, it also had to make few compromises. Interface unlocking in one of the most popular of those decisions.
Interfaces in Java could only have abstract methods until Java 7. Once an interface is made public, it was not possible to change it without breaking the existing code.
However to support features such as lambdas and functional programming, Java had to make changes to existing interfaces also. This eventually resulted in a complete makeover of interfaces with additions such as default methods, static methods etc.