Stream API migration: do not convert continue statements which belong to the nested loops (IDEA-204250)

This commit is contained in:
Tagir Valeev
2018-12-18 12:28:52 +07:00
parent 7cad465cd2
commit 362b8d0b34
3 changed files with 37 additions and 0 deletions
@@ -0,0 +1,17 @@
// "Replace with forEach" "true"
import java.util.Arrays;
import java.util.Collection;
public class Test {
void test(int[] arr, int[] arr2) {
Arrays.stream(arr).forEach(x -> {
int y = x * 2;
if (x > y) return; // comment
for (int i : arr2) {
if (i % 2 == 0) continue;
System.out.println(x);
}
});
}
}
@@ -0,0 +1,16 @@
// "Replace with forEach" "true"
import java.util.Collection;
public class Test {
void test(int[] arr, int[] arr2) {
for<caret>(int x : arr) {
int y = x*2;
if(x > y) continue; // comment
for(int i : arr2) {
if (i % 2 == 0) continue;
System.out.println(x);
}
}
}
}