Iterate values without index
Section: Enhanced for (for-each)
Enhanced for (for-each)
java
java
for (String s : list) {\n System.out.println(s);\n}Explanation
Use for-each when you don’t need the index.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Enhanced for (for-each)