StreamToLoopInspection: reuse existing variable if we should reassign it in loop, but it's possible to use it as non-final

This commit is contained in:
Tagir Valeev
2016-12-23 13:30:08 +07:00
parent 4a2a11c85f
commit 1e33755e09
12 changed files with 147 additions and 27 deletions
@@ -0,0 +1,18 @@
// "Replace Stream API chain with loop" "true"
import java.util.List;
public class Main {
public void test(List<Integer> list) {
boolean x = false;
for (Integer i : list) {
if (i <= 2) {
x = true;
break;
}
}
if(x) {
System.out.println("found");
}
}
}