Topics

Leave a Reply

12 Comments on "Java 8 Lambda Basics 19 – Closures in Lambda Expressions"

Notify of
avatar

Rajat Mishra
Guest
Rajat Mishra
10 months 2 days ago

Where do you read about all these interesting things? Do you follow a book? Please recommend.

Rajat Mishra
Guest
Rajat Mishra
10 months 2 days ago

Where do you read about all these interesting things? Do you follow a book? Please recommend.

Imran Butt
Guest
Imran Butt
10 months 9 days ago

All tutorials are awesome !!!Step by Step and first elaborating what we were doing right now and what particular change we should do, elaborates every detail.Hats Off 🙂

Imran Butt
Guest
Imran Butt
10 months 9 days ago

All tutorials are awesome !!!Step by Step and first elaborating what we were doing right now and what particular change we should do, elaborates every detail.Hats Off 🙂

Jarl Øystein Samseth
Guest
Jarl Øystein Samseth
11 months 26 days ago
You're tutorials are superb. However, I just wanted to note that you can change the value of variable b, inside the lambda expression. I may have misunderstood you, but I wouldn't call it final if I change the b-value in the lambda expression. Then again, I haven't fully grasped the "effectively final" expression.I tested it by the following code:public class Main { static int b=2; void a(Runnable r){r.run();} public static void main(String[] args) { Main m = new Main(); m.a(()-> System.out.println(b)); m.a(()-> {b++; System.out.println(b);}); System.out.println(b); Runnable x = () -> {b++; System.out.println(b);}; m.a(x); m.a(x); m.a(x); }}This gave the output:233456Hence b… Read more »
Jarl Øystein Samseth
Guest
Jarl Øystein Samseth
11 months 26 days ago
You're tutorials are superb. However, I just wanted to note that you can change the value of variable b, inside the lambda expression. I may have misunderstood you, but I wouldn't call it final if I change the b-value in the lambda expression. Then again, I haven't fully grasped the "effectively final" expression.I tested it by the following code:public class Main { static int b=2; void a(Runnable r){r.run();} public static void main(String[] args) { Main m = new Main(); m.a(()-> System.out.println(b)); m.a(()-> {b++; System.out.println(b);}); System.out.println(b); Runnable x = () -> {b++; System.out.println(b);}; m.a(x); m.a(x); m.a(x); }}This gave the output:233456Hence b… Read more »
Guram Kankava
Guest
Guram Kankava
1 year 4 months ago

Thank you very much.

Guram Kankava
Guest
Guram Kankava
1 year 4 months ago

Thank you very much.

Baba Gilo
Guest
Baba Gilo
1 year 6 months ago

What do you think if we always use $ as the method name in functional interface?

Baba Gilo
Guest
Baba Gilo
1 year 6 months ago

What do you think if we always use $ as the method name in functional interface?

wpDiscuz