mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
EnsureCodeBlock: support or-chains in return/lambdas
This commit is contained in:
+17
@@ -0,0 +1,17 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Main {
|
||||
public boolean testCond(List<String> list) {
|
||||
if (list.stream().noneMatch(String::isEmpty)) return false;
|
||||
for (String s : list) {
|
||||
if (s == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Main {
|
||||
public boolean testCond(List<String> list) {
|
||||
if (list.stream().anyMatch(String::isEmpty)) return true;
|
||||
for (String s : list) {
|
||||
if (s == null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Main {
|
||||
public boolean testCond(List<String> list) {
|
||||
return list.stream().anyMatch(String::isEmpty) && list.stream().any<caret>Match(Objects::isNull);
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class Main {
|
||||
public boolean testCond(List<String> list) {
|
||||
return list.stream().anyMatch(String::isEmpty) || list.stream().any<caret>Match(Objects::isNull);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user