mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
IDEA-161002 Support cases like if(...) { for(...) {...} } return false;
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace with anyMatch()" "true"
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// "Replace with anyMatch()" "true"
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// "Replace with anyMatch()" "true"
|
||||
|
||||
public class Main {
|
||||
boolean contains(String[][] haystack, String needle) {
|
||||
if(haystack != null)
|
||||
for (String[] row : haysta<caret>ck) {
|
||||
if (row == null) continue;
|
||||
for (String str : row) {
|
||||
if (needle.equals(str))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Replace with anyMatch()" "true"
|
||||
|
||||
public class Main {
|
||||
boolean contains(String[][] haystack, String needle) {
|
||||
if(haystack != null) {
|
||||
for (String[] row : haysta<caret>ck) {
|
||||
if (row == null) continue;
|
||||
for (String str : row) {
|
||||
if (needle.equals(str))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Replace with anyMatch()" "false"
|
||||
|
||||
public class Main {
|
||||
boolean contains(String[][] haystack, String needle) {
|
||||
if(haystack != null) {
|
||||
for (String[] row : haysta<caret>ck) {
|
||||
if (row == null) continue;
|
||||
for (String str : row) {
|
||||
if (needle.equals(str))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
System.out.println("Oops");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user