Stephan van Hulst wrote:Why don't you show us an example of the two alternatives, and then tell us what you think the pros and cons of the two approaches are?
Sure, below are the examples of lambda to add two numbers in
Java and Python and also the code of doing it in way other than lambda.
Java :
Python
What I can see is:
Advantage of lambda in Java over doing the same thing without lambda :
Without lambda for this we required anonymous class implementation code, which made the code less readable. With lambda it is more readable.
Advantage of lambda in Python over way of doing it without lambda :
Only that one does not have to create a function.
Can one say that using lambda gives more advantage over not using it in Java as compared to what it gives in Python ?