mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 10:20:15 +07:00
23 lines
492 B
Java
23 lines
492 B
Java
// "Replace Stream API chain with loop" "true"
|
|
|
|
import java.util.*;
|
|
import java.util.stream.*;
|
|
|
|
public class Main {
|
|
|
|
private static int test() {
|
|
OptionalInt found = OptionalInt.empty();
|
|
for (int x = 0; x < 100; x++) {
|
|
if (x > 50) {
|
|
found = OptionalInt.of(x);
|
|
break;
|
|
}
|
|
}
|
|
int res = found.orElseGet(() -> Math.abs(-1));
|
|
return res;
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
System.out.println(test());
|
|
}
|
|
} |