summaryrefslogtreecommitdiff
path: root/plugins/InspectionGadgets/src/inspectionDescriptions/ForCanBeForeach.html
blob: 2e6283893e0beae64be9bd0a24b5137e00f274a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<html>
<body>
Reports <b>for</b> loops which iterate
over collections or arrays, and can be replaced with the "for each" iteration syntax, available
in Java 5 and newer.
<!-- tooltip end -->
<p>
Use the first checkbox below to find loops involving <b>list.get(index)</b> calls.
These loops generally can be replaced with the <b>foreach</b> loops, unless they modify underlying list in the process, e.g. by calling <b>list.remove(index)</b>.
If latter is the case, <b>foreach</b> form of loop may throw <b>ConcurrentModificationException</b>.
<p>
Use the second checkbox below to ignore collections which do not have type parameters. This avoids the creating of
foreach loop variables of type <b>java.lang.Object</b> and casts by the quickfix
<p>
This inspection only reports if the project or module is configured to use a
language level of 5.0 or higher.
<p>
<small>Powered by InspectionGadgets</small>
</body>
</html>