IDEA-161198 Migration from Stream API back to for loops

This commit is contained in:
Tagir Valeev
2016-11-01 15:38:57 +07:00
parent 994b0f84a9
commit 9caa6d5ede
181 changed files with 5276 additions and 0 deletions
@@ -0,0 +1,21 @@
// "Replace Stream API chain with loop" "true"
import java.util.stream.IntStream;
public class Main {
private static long check(int start, double val) {
long count = 0;
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(2, 0.04));
}
}