Difference between final and effectively final


final variable: A variable or parameter is declared as final and whose value is never changed after it is initialized is final.

effectively final variable: A variable or parameter is not declared as final and still the whose value is never changed after it is initialized is effectively final.
public class Demo {
 public static void main(String[] args) {
 int count = 0;
 List list = new ArrayList() {{
    add("employee1"); 
    add("employee2"); 
    add("employee3"); 
    add("employee4"); 
 }}; 
 list.stream().forEach(str -> { count++; });
 } 
}
here the error on count++ :-
Local variable count defined in an enclosing scope must be final or effectively final.

here the variable count is not declared as final but it is still a final variable and its value will not be changed, the count varibale here is effectively final variable

Functional programming with Java - Part 1

 Recently I was reviewing one PR raised by team memeber and going through one utitlity method and found out there are too many muatable vari...