mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 14:23:28 +07:00
Fixes IDEA-350194 Inspection QuickFix results in compilation error GitOrigin-RevId: fb83bfcb4e4aef9dc87a5c84de6d08202dd52ec6
22 lines
448 B
Java
22 lines
448 B
Java
// "Collapse loop with stream 'findFirst()'" "true-preview"
|
|
|
|
import java.util.List;
|
|
import java.util.Objects;
|
|
|
|
public class Main {
|
|
private final Point field = new Point(0, 0);
|
|
|
|
public Point find(List<Point> points) {
|
|
return points.stream().filter(Objects::nonNull).findFirst().orElse(field);
|
|
}
|
|
|
|
static class Point {
|
|
private int x;
|
|
private int y;
|
|
|
|
Point(int x, int y) {
|
|
this.x = x;
|
|
this.y = y;
|
|
}
|
|
}
|
|
} |