Skip to content
Advertisement

Getting local variable defined in the enclosing scope must be final or effective final

I am getting “local variable defined in the enclosing scope must be final or effective final” as highlighted below. I am not sure how to fix this out in lambda expression.

enter image description here

JavaScript

Advertisement

Answer

Try replacing this:

JavaScript

by this:

JavaScript

The entitlePackage will be effectively final. Also your code will be much easier to read and maintain.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement