Lambdas in Java 8
The most important change in Java 8 is the introduction of lambda expressions. They enable faster, clearer coding and make it possible to use functional programming.
Java was created back in the '90s as an object-oriented programming language, with the idea that everything should be an object. At that time, object-oriented programming was the principal paradigm for software development. But, recently, functional programming has become increasingly popular because it is well-suited for concurrent and event-driven programming. This doesn't mean that we should stop writing code using object-oriented languages. Instead, the best strategy is to mix elements of object-oriented and functional programming. Adding lambdas to Java 8 ties in with this idea—Java is an object-oriented language, but now it has lambdas, we are able to code using the functional style too.
Let's look at this new feature in detail.
Introducing the new syntax and semantics
In order to...