Following is My Code
List<Lead> Mylead = adminService.GetMyData(10);
int i=0;
Mylead.forEach(lead->{
  i++;
});
Error : Local variable I defined in an enclosing scope must be final or effectively final
Following is My Code
List<Lead> Mylead = adminService.GetMyData(10);
int i=0;
Mylead.forEach(lead->{
  i++;
});
Error : Local variable I defined in an enclosing scope must be final or effectively final
 
    
    You have to create a wrapper for i, a simple way to do this would be an array.
List<Lead> Mylead = adminService.GetMyData(10);
final int[] i={0};
Mylead.forEach(lead->{
  i[0]++;
});
For a detailed explanation how this works see: Java 8 Lambda variable scope