Lambda expression in Java - A new way of coding

How it looks if we have functionality of passing the method implementation as a parameter?Awesome isn't it? Yeah now we can do this magic in Java through Lambda expression.Oracle recently included Lambda expression in Java as a part of Java 8 release. So let's explore few things about Lambda expression in Java. A lambda expression is like syntactic sugar for an anonymous class with one method whose type is inferred. Syntax : The main syntax of a lambda expression is “parameters -> body”. The compiler can usually use the context of the lambda expression to determine the functional interfac e being used and the types of the parameters. There are four important rules to the syntax: Declaring the types of the parameters is optional. Using parentheses around the parameter is optional if you have only one parameter. Using curly braces is optional (unless you need multiple statements). The “return” keyword is optional if you have a sing...