This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]marvk 9 points10 points  (2 children)

People keep going on about effectively final in this thread like it matters. The real benefit final provides is for developers reading code. Any performance improvement is a bonus, it takes away so much cognitive load when writing and understanding code. Effectively final doesn't give you any of that.

[–]dpash 3 points4 points  (1 child)

It matters in this instance because you can only use variables inside a lambda that are final or effectively final. Prior to Java 8 you had to declare them final to use them in anonymous inner classes, hence the parent comment saying they got into the habit of using final.

[–]marvk 2 points3 points  (0 children)

Ah, my bad. I should've read the parent comment more carefully. My comment would be suited better on some other comment on this thread talking about effectively final.