lambdas | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

lambdas

What is lambdas and when is it good to use them?

13th Nov 2016, 7:53 PM
Ousmane Diaw
2 Answers
+ 1
You can use lambdas to iterate over collections or sets. Lambdas are also alternative for anonymous inner classes, when overriden class implements interface Consumer, Consumable or Runnable. Lambdas are included in Java 8 and brings some functional programming. For example: collection.forEach((e) -> {System.err.println(e.toString());})
13th Nov 2016, 10:24 PM
Marcin Las
Marcin Las - avatar
0
Thanks!
13th Nov 2016, 10:28 PM
Ousmane Diaw