Java 8 Lambda Expressions | Code Factory
Lambda expression is a new and important feature of Java which was included in Java SE 8. Lambda expression facilitates functional programming, and simplifies the development a lot. Syntax ( Arguments / parameters) -> {Body} Java lambda expression is consisted of three components. 1) Argument / Parameters: It can be empty or non-empty as well. 2) Arrow-token: It is used to link arguments-list and body of expression. 3) Body: It contains expressions and statements for lambda expression. Java Example without Lambda Expression interface Drawable { public void draw(); } public class Main { public static void main(String[] args) { int width = 10; // without lambda, Drawable implementation using anonymous class Drawable d = new Drawable() { public void draw() { System.out.println("Drawing " + width); } }; d.draw(); } } Output : Drawing 10 Java Example with Lambda Expression @FunctionalInterfac...