posted 1 month ago
Mikalai is quite correct that the central issue in your question is answered by the fact that you are not, in fact, using lambdas here. You are using method references, and they have different rules. They have no problem with variables being final or effectively final.
The stack overflow link refers in several places to "final variables" when it should really talk about effectively final variables. So be careful when reading it; some of the statements may be misleading.
Your code example does not have any effectively final variables. The variable on line 7 could have been effectively final, if you had not added code on lines 8 and 12 which changes it. Once you do that, the variable is no effectively final anywhere, even at line 7.