Inspectopedia Help

Statement lambda can be replaced with expression lambda

Reports lambda expressions with code block bodies when expression-style bodies can be used instead. The result of the conversion is shorter and more clear.

Example:

Comparable<String> c = o -> {return 0;};

After the quick-fix is applied:

Comparable<String> c = o -> 0;

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023