mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 10:20:15 +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:
@@ -1,12 +1,14 @@
|
||||
// "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) {
|
||||
long count = list.stream().filter(s -> !s.isEmpty()).co<caret>unt();
|
||||
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