mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 18:28:55 +07:00
StreamToLoop tests grouped
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
// "Fix all 'Stream API call chain can be replaced with loop' problems in file" "true"
|
||||
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
@@ -14,7 +14,20 @@ public class Main {
|
||||
return count;
|
||||
}
|
||||
|
||||
private static long checkClosed(int start, double val) {
|
||||
long count = 0L;
|
||||
int bound = start * 200;
|
||||
for (int x = start; x <= bound; x++) {
|
||||
double v = 1.0 / x;
|
||||
if (v < val) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println(check(1, 100, 0.04));
|
||||
System.out.println(checkClosed(2, 0.04));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user