Lambda Express in Java
The very important features of Lambda Expressions are that they execute in the context of their appearance. So, a similar lambda expression can be executed differently in some other context (i.e. logic will be same but results will be different based on different parameters passed to function).
The benefits involved in functional programming over object oriented programming (OOP). Most OOP languages evolve around objects and instances and treat only them their first class citizens. Another important entity i.e. functions take back seat. This is especially true in java, where functions can’t exist outside an object. A function itself does not mean anything in java, until it is related to some object or instance.
(p, q) -> p + q
(int p, int q) -> p * q
(p, q) -> p – q
() -> 99
(String p) -> System.out.println(p)
p -> 2 * p