I have the following piece of Java code
ImmutableList<Element> elements = ...;
for (Element e : elements) {
e.doSomething();
}
where ImmutableList
is part of the Guava library. NetBeans suggest me to convert the code using the `Convert to for (Iterator...) {}' suggestion which results in the following transformation
ImmutableList<Element> elements = ...;
for (Iterator<Element> it = elements.iterator(); it.hasNext();) {
Element e = it.next();
e.doSomething;
}
I fail to see a reason for this transformation. I'm using Java 1.7 and NetBeans 7.4. Can somebody enlighten me?