mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 02:38:59 +07:00
17 lines
428 B
Java
17 lines
428 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) {
|
|
if (Arrays.stream(haystack).filter(Objects::nonNull).flatMap(Arrays::stream).anyMatch(needle::equals)) {
|
|
return true;
|
|
}
|
|
System.out.println("Oops");
|
|
}
|
|
return false;
|
|
}
|
|
}
|