Inspectopedia
 
2024.3

Statement lambda can be replaced with expression lambda

Warning
New
Last modified: 03 December 2024

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:

After the quick-fix is applied:

This inspection depends on the Java feature 'Lambda expressions', which is available since Java 8.