could you please explain me, why the list-variable in line 108 has this specific color and is underlined?
If i put the same code in a for-each instead of a foreach(), then it looks "normal".
Thank you in advance!
For the first thing you're using lambda which is syntactic sugar. At the second thing the purple underline appears if a variable isn't from inside the lambda to show the user you're not using a local variable.
For example:
public static void main(String[] args) {
int a = 0;
Consumer<String> stringConsumer = foo -> {
foo += a;
};
for (int i = 0; i < 1; i++) {
String s = " " + a;
}
}
If you paste that you'll see that only the a
in foo += a
gets purple underlined because it's from outside the lambda.
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