Inspectopedia Help

Enhanced 'for' statement

Reports enhanced for statements.


for (int x: Arrays.asList(1, 2, 3)) { System.out.println(x); }

After the quick-fix is applied:

for (Iterator<Integer> iterator = Arrays.asList(1, 2, 3).iterator(); iterator.hasNext(); ) { final int x =; System.out.println(x); }

Enhanced for statement appeared in Java 5. 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


Java, 233.SNAPSHOT

Last modified: 13 July 2023