Java intention: Quick fix for error "foreach not applicable to type java.util.Iterator" - a test added (IDEA-124751)

This commit is contained in:
Pavel Dolgov
2016-07-01 16:28:17 +03:00
parent b252c32c1f
commit 9104e6ede4
3 changed files with 43 additions and 0 deletions
@@ -0,0 +1,11 @@
// "Replace 'for each' loop with iterator 'for' loop" "true"
import java.util.Iterator;
public class FinalItem {
void foo(Iterator<Integer> it) {
for (Iterator<Integer> it1 = it; it1.hasNext(); ) {
final Integer integer = it1.next();
System.out.println(integer);
}
}
}
@@ -0,0 +1,8 @@
// "Replace 'for each' loop with iterator 'for' loop" "true"
import java.util.Iterator;
public class FinalItem {
void foo(Iterator<Integer> it) {
for (Integer integer : <caret>it) System.out.println(integer);
}
}