mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-29 16:50:55 +07:00
13 lines
366 B
Java
13 lines
366 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) {
|
|
if(list != null) {
|
|
return list.stream().flatMap(Collection::stream).filter(string -> string.startsWith("ABC")).findFirst().orElse(null);
|
|
}
|
|
return null;
|
|
}
|
|
} |