mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-17 15:50:53 +07:00
13 lines
352 B
Java
13 lines
352 B
Java
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Objects;
|
|
|
|
public class Main {
|
|
boolean contains(String[][] haystack, String needle) {
|
|
if(haystack != null)
|
|
return Arrays.stream(haystack).filter(Objects::nonNull).flatMap(Arrays::stream).anyMatch(needle::equals);
|
|
return false;
|
|
}
|
|
}
|