Jeanne Boyarsky wrote:The lambda only cares about things that come before it. When the code is in location A and the lambda comes along, "c" is taken and can't be reused. In location B, the lambda isn't in scope anymore so "c" doesn't produce such a conflict.
This is also true if you replace the lambda with an ordinary { ... } code block, so evidently the rule has been around since the beginning of
Java. That was something I didn't know because I wouldn't ever have written code with duplicate local variable names like that.