mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 09:39:37 +07:00
10 lines
388 B
Java
10 lines
388 B
Java
// "Collapse loop with stream 'findFirst()'" "true-preview"
|
|
|
|
import java.util.Collection;
|
|
import java.util.List;
|
|
|
|
public class Main {
|
|
public static String find(List<List<String>> list) {
|
|
return list.stream().flatMap(Collection::stream).filter(string -> string.startsWith("ABC")).findFirst().filter(string -> string.substring(3).equals("xyz")).map(String::trim).orElse(null);
|
|
}
|
|
} |