• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Practical usage of Lambda

 
Ranch Hand
Posts: 58
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am going over the new features of Java 8. One of them would be Lambda expressions.

I know with Lambda, we can pass functions as method parameters. With respect to mathematical operations, we can pass the function as method parameter. But in what way, does this functionality majorly improves the java capability? Meaning, how are we achieving the most of this functionality with respect to application development?

Can someone throw light on this one?

Thanks
 
Nandhini Sridharan
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would like to answer my question by myself

Thanks to the post https://coderanch.com/t/646488/java/java/Core-Java-benefits-lambda-expressions

The advantages of Lambda with respect to Java programming is that

1. It aids less typing (Without beating around the bush, just expresses the actual calculation being made and fading out unnecessary syntax information)
2. The above statement also serves in another way that the programmer is just interested in what is being done (the actual business logic) than the decorating code like public static all those blah blah blah
3. When we pass function as method parameter, the method really need to know what is the result of that function rather than how the result has been achieved
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The book "Java 8 in Action" has lots of examples of how lambdas can help you write simpler and more elegant programs that are closer to the functional style of programming. To say that lambdas help reduce typing is very superficial, IMO. That you have to type less is just a natural consequence of being able to write more concise code. The conciseness and clarity of the code that you can write with lambdas is what is really important along with the shift to functional programming.
 
reply
    Bookmark Topic Watch Topic
  • New Topic