mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-02 14:20:55 +07:00
12 lines
362 B
Java
12 lines
362 B
Java
// "Collapse loop with stream 'sum()'" "true-preview"
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Objects;
|
|
|
|
public class Main {
|
|
public double test(String[][] array) {
|
|
double d = 10;
|
|
d += Arrays.stream(array).filter(Objects::nonNull).flatMap(Arrays::stream).filter(a -> a.startsWith("xyz")).mapToDouble(a -> 1.0 / a.length()).sum();
|
|
return d;
|
|
}
|
|
} |