IntelliJ - pink underlined variable... what does it mean?
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.