mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 21:55:01 +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:
+3
-1
@@ -1,6 +1,7 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.LongSupplier;
|
||||
|
||||
public class Main {
|
||||
private static void test(List<String> list) {
|
||||
@@ -12,7 +13,8 @@ public class Main {
|
||||
}
|
||||
long count = count1;
|
||||
if(count > 10) {
|
||||
long result = count*2;
|
||||
LongSupplier sup = () -> count*2;
|
||||
long result = sup.get();
|
||||
System.out.println(result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user