How to write Lambda Expression in Java 8
How to write Lambda Expression? With the introduction of Lambda Expression in JAVA 8, We can write more readable, maintainable and concise code but I have seen people keep forgetting the syntax of lambda expression or they are always confused with it. In this blog, I ll just try to explain the basic things i.e. how easy is it to write Lambda Expression but before starting with the syntax, Let’ see what is lambda Expression? In simple term, Lambda expression (->) is an anonymous function which - doesn’t have any name - doesn’t have any modifiers - doesn’t have any return type. To understand it in a more easy way, Let’s first write a simple Java function which display some message on the console. Example 1: Display Message public void display (){ system.out.println(“Learning Lambda Expression”); } Now to convert the above code into lambda expression, read the lambda definition once aga...