mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-24 17:51:09 +07:00
18 lines
457 B
Java
18 lines
457 B
Java
// "Replace Stream API chain with loop" "true-preview"
|
|
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
|
|
public class Main {
|
|
private static String test(List<String> list) {
|
|
if (list == null) {
|
|
return null;
|
|
} else {
|
|
return list.stream().filter(str -> str.contains("x")).find<caret>First().orElse(null); // comment
|
|
}
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
System.out.println(test(Arrays.asList("a", "b", "syz")));
|
|
}
|
|
} |