int count =0;
requestUserDto.getNodeIds().forEach(userNodeId->{
count++; // this statement shows error
// some another statements here
}
});
why count++ shows error
Error:
Local variable i defined in an enclosing scope must be final or effectively final
Considering lambdas are essentially syntactic sugar for an anonymous inner class, a variable used in a lambda expression must be effectively final. Check out this post for more details.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With