mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
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:
+18
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user