mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 18:58:31 +07:00
24 lines
542 B
Java
24 lines
542 B
Java
// "Replace Stream API chain with loop" "true"
|
|
|
|
import java.util.OptionalInt;
|
|
import java.util.stream.IntStream;
|
|
|
|
public class Main {
|
|
private static OptionalInt test() {
|
|
boolean seen = false;
|
|
int acc = 0;
|
|
for (int i : new int[]{}) {
|
|
if (!seen) {
|
|
seen = true;
|
|
acc = i;
|
|
} else {
|
|
acc = acc * i;
|
|
}
|
|
}
|
|
return seen ? OptionalInt.of(acc) : OptionalInt.empty();
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
System.out.println(test());
|
|
}
|
|
} |