mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-25 10:51:06 +07:00
16 lines
407 B
Java
16 lines
407 B
Java
// "Collapse loop with stream 'anyMatch()'" "true-preview"
|
|
|
|
import java.util.Arrays;
|
|
import java.util.Objects;
|
|
|
|
public class Main {
|
|
void contains(String[][] haystack, String needle) {
|
|
if(haystack != null) {
|
|
if (Arrays.stream(haystack).filter(Objects::nonNull).flatMap(Arrays::stream).anyMatch(needle::equals)) {
|
|
return;
|
|
}
|
|
}
|
|
throw new IllegalStateException();
|
|
}
|
|
}
|