Today I have learnt Lambda Expression in Java which is introduced in Java 8.
Syntax : () -> { /* code block */ };
If there are parameters, write them inside Parenthesis/Round brackets.
#lambdaExpression#java#java8#SoftwareDevelopment
Happy Learning!
Learn how to sort a list of integers in descending order using a lambda expression in Java. TANIAOKA, Akihiro explains the process and why option D is the correct answer. #Java#LambdaExpression#ProgrammingTipsift.tt/lbhxBTH
#Java Tips:
If you happen to pass a lambda expression to a method that does Integer addition only,e.g
(currentValue, incremental) -> currentValue + incremental);
You can replace the whole line with-
Integer::sum
#LambdaExpression#MethodReference
What is Lambda expression?
Through lambda expression you can create an anonymous function pretty easily in your code.
Exp.
square of a number
(lambda x: x**2, value of x)
X is the variable.
#python#lambdaexpression