mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
IDEA-161002 anyMatch/noneMatch disabled for non-final vars; allMatch is supported
This commit is contained in:
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with allMatch()" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Main {
|
||||
boolean find(String[][] data) {
|
||||
return Arrays.stream(data).flatMap(Arrays::stream).allMatch(str -> str.startsWith("xyz"));
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace with allMatch()" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Main {
|
||||
boolean allEmpty(String[][] data) {
|
||||
return Arrays.stream(data).flatMap(Arrays::stream).allMatch(String::isEmpty);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with allMatch()" "true"
|
||||
|
||||
public class Main {
|
||||
boolean find(String[][] data) {
|
||||
for(String[] arr : da<caret>ta) {
|
||||
for(String str : arr) {
|
||||
if(!str.startsWith("xyz")) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with allMatch()" "true"
|
||||
|
||||
public class Main {
|
||||
boolean allEmpty(String[][] data) {
|
||||
for(String[] arr : da<caret>ta) {
|
||||
for(String str : arr) {
|
||||
if(!str.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Replace with anyMatch()" "false"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Main {
|
||||
boolean find(List<String> data, String prefix) {
|
||||
if(prefix == null)
|
||||
prefix = "xyz";
|
||||
for(String e : da<caret>ta) {
|
||||
String trimmed = e.trim();
|
||||
if(trimmed.startsWith(prefix)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user