mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-02 11:18:16 +07:00
EnsureCodeBlock: support or-chains in return/lambdas
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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