Back to Intellij Community

CodeBlock2Expr

java/java-impl/resources/inspectionDescriptions/CodeBlock2Expr.html

2025.3-rc-2288 B
Original Source

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;