mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-21 04:50:58 +07:00
16 lines
347 B
Java
16 lines
347 B
Java
// "Collapse loop with stream 'forEach()'" "true-preview"
|
|
|
|
import java.util.stream.Stream;
|
|
|
|
public class Main {
|
|
static class A {
|
|
A next(){return null;}
|
|
int x;
|
|
}
|
|
|
|
static boolean isGood(A a) {}
|
|
|
|
public long test() {
|
|
Stream.iterate(new A(), a -> isGood(a), a -> a.next()).filter(a -> a.x < 3).forEach(System.out::println);
|
|
}
|
|
} |