A Lambda Expression is a small block of code like a method. It is shorter and can return a code. Lambda expressions are very useful to replace anonymous methods or normal methods.
Basic syntax and use of lambda expressions. You can see normal ways to run a block of code and then how we can implement the same through lambda expressions. Here I have used Lambda expressions in Runnable Threads also.
Java Fx is the most common use of Lambda expressions. Here you can see a small example of Lambda expressions being used in JavaFX, in which we call a method that uses it when a button is pressed.
When an expression is just one like we don't need to explicitly return a value, but when we write expressions that are bigger than that we have to return the value manually. Here you can see examples of a multi-line expression using an anonymous class and a Lambda expression. You can also see the use of a non-Static class 'AnotherClass'.
Predicates and Suppliers and Consumers and a lot more can be seen in this file. You can see examples of functions, Channing functions, BIFunction, Unary Operator, supplier, consumer, and Predicates.
here we can see an example of using streams, we use this in one example to sort an array. You can also see examples of, .collect, .sorted, .forEach, .filter
.
We can see examples of .flatMap
here, we use this for basic operations.
This is a program that is using all the concepts covered so far in this file. You will be able to see all the above processes and methods used here.