mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-161194 Add inspection to optimize Stream.filter(...).findAny().isPresent() to anyMatch(...)
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
// "Replace Stream.filter().findAny().isPresent() with Stream.anyMatch()" "true"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class FilterFindIsPresent {
|
||||
public static void test(List<String> list) {
|
||||
if(list.stream().anyMatch(l -> !l.isEmpty())) {
|
||||
System.out.println("oops");
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace Stream.filter().findFirst().isPresent() with Stream.anyMatch()" "true"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class FilterFindIsPresent {
|
||||
public static void test(List<String> list) {
|
||||
if(list.stream().anyMatch(l -> !l.isEmpty())) {
|
||||
System.out.println("oops");
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace Stream.filter().findAny().isPresent() with Stream.anyMatch()" "true"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class FilterFindIsPresent {
|
||||
public static void test(List<String> list) {
|
||||
if(list.stream().fi<caret>lter(l -> !l.isEmpty()).findAny().isPresent()) {
|
||||
System.out.println("oops");
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Replace Stream.filter().findFirst().isPresent() with Stream.anyMatch()" "true"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
class FilterFindIsPresent {
|
||||
public static void test(List<String> list) {
|
||||
if(list.stream().filter(l -> !l.isEmpty()).findFirst().isPre<caret>sent()) {
|
||||
System.out.println("oops");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user