Inspectopedia
 
2024.3

Simplifiable forEach() call

Info
New
Last modified: 03 December 2024

Reports forEach() calls that can be replaced with a more concise method or from which intermediate steps can be extracted.

Example:

After the quick-fix is applied:

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

New in 2017.3