• Post Reply Bookmark Topic Watch Topic
  • New Topic

Mastering Lamdas - Why ?

 
paul nisset
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
Ever since it came out as a feature of Java8 ,I've been wondering why or how I would use Lambda expressions.
If it is just a matter of it being syntactically shorter why not use another Java compiled language with leaner syntax like Groovy or Scala?

Thanks,
Paul
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
105
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why learn a whole new language when learning a new notation for Java will take 1/10000th of the time?

 
Maurice Naftalin
Author
Greenhorn
Posts: 20
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paul

This seems to be two questions really: first, why would you want to use lambdas?; second, if you did find a use for them, why not switch to a different language that already has them? For the first, I'd recommend reading the book, which gives a lot of examples of how code using the Java Collections Framework and other APIs (especially new ones that will be designed with lambdas in mind) will be more concise, more readable, and more maintainable than its non-lambda equivalent. For the second, I agree with Bear: lambdas are not so wonderful and all-important that you would choose a language solely on the basis of its lambda features, especially if you were already heavily invested in Java.

Regards
Maurice
 
Winston Gutkowski
Bartender
Posts: 10571
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
paul nisset wrote:Ever since it came out as a feature of Java8 ,I've been wondering why or how I would use Lambda expressions.

Have a look at this. Best explanation I've seen for Lambdas bar none - and from a guy with only 2 posts!

it certainly makes me want to look at them some more. I love WhatNotHow stuff.

Winston
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!