Introduction to Java 8
Released in March 2014, Java 8 is widely considered the most revolutionary and significant release in the history of the Java programming language.
Functional Interfaces
Before Java 8, passing a "behavior" or a "function" as an argument to a method was extremely difficult. You had to create an interface, write a class that implemented the interface, and then pass an object of that class.
Lambda Expressions
A Lambda Expression is a short block of code which takes in parameters and returns a value.
Method References
Method References are a special type of syntactic sugar introduced in Java 8. They provide a shorter, more readable alternative to Lambda expressions when the lambda expression does absolutely nothing except call an existing method.
The Stream API
The Stream API (located in the java.util.stream package) is arguably the most famous and widely used feature introduced in Java 8.
The Optional Class
The Optional class was introduced in Java 8 to address one of the most infamous problems in computer science: the NullPointerException (NPE), often referred to as the "Billion Dollar Mistake".
Default & Static Methods
Before Java 8, an interface was a strict contract: it could only contain abstract method signatures (methods without a body) and constant variables (public static final). If a class implemented an interface, it was forced to provide an implementation for every single method defined in that interface.