Files
openide/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/quickFix/streamApiMigration/java19/afterPatternUsed.java
Andrey.Cherkasov f78c90027c [java-inspections] StreamApiMigration: "Replace with collect" fix produces wrong code for record patterns
IDEA-300726

GitOrigin-RevId: 83c638a60f4dee0a363b285535e808140e853fae
2022-08-29 17:03:09 +00:00

18 lines
502 B
Java

// "Fix all 'Loop can be collapsed with Stream API' problems in file" "true"
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
class X {
void test(List<Object> list) {
List<Rect> result = list.stream().filter(o -> o instanceof Rect(
Point point1, Point(double x2, double y2) point2
) rect && x2 > point1.x()).map(o -> rect).collect(Collectors.toList());
}
}
record Point(double x, double y) {
}
record Rect(Point point1, Point point2) {
}