Lambda can be replaced with anonymous class
Reports lambda expressions that can be replaced with anonymous classes.
Expanding lambda expressions to anonymous classes may be useful if you need to implement other methods inside an anonymous class.
Example:
s -> System.out.println(s)
After the quick-fix is applied:
new Consumer<String>() {
@Override
public void accept(String s) {
System.out.println(s);
}
}
Lambda expression appeared in Java 8. This inspection can help to downgrade for backward compatibility with earlier Java versions.
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |
Last modified: 13 July 2023