I am using jdk-11 for this tutorial. We are going to use lambda functions to create a thread in java. In this tutorial, we will implement Runnable interface. Our lambda implementation will print numbers from the range 1 to 10. Step 1 :- implement Runnable interface Runnable runThroughLambda = () -> IntStream.rangeClosed(1, 10) .forEach(System.out::println); In above code, I […]
What is lambdas in Java – Understanding Lamdas in Java
Lambdas were introduced in Java 8. For me they are first step towards functional programming in java. Lambdas are a little like anonymous class. They are similar in the way they are defined and passed around as a parameter in functions. But, lambdas are not exactly an anonymous class. After compilation, an anonymous class has […]