mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SimplifyStreamApiCallChainsInspection: support primitive anyMatch/noneMatch/allMatch conversions
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace Stream.allMatch(x -> !(...)) with Stream.noneMatch(...)" "true"
|
||||
// "Replace Stream.allMatch(x -> !(...)) with noneMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace !Stream.allMatch(x -> !(...)) with Stream.anyMatch(...)" "true"
|
||||
// "Replace !Stream.allMatch(x -> !(...)) with anyMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace DoubleStream.allMatch(x -> !(...)) with noneMatch(...)" "true"
|
||||
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
public boolean testAllMatch(double[] data) {
|
||||
if(DoubleStream.of(data).noneMatch(d -> Double.isNaN(d)))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace !Stream.anyMatch(...) with Stream.noneMatch(...)" "true"
|
||||
// "Replace !Stream.anyMatch(...) with noneMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace !Stream.anyMatch(x -> !(...)) with Stream.allMatch(...)" "true"
|
||||
// "Replace !Stream.anyMatch(x -> !(...)) with allMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace !LongStream.anyMatch(...) with noneMatch(...)" "true"
|
||||
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
public boolean testAnyMatch(long[] data) {
|
||||
if(LongStream.of(data).noneMatch(i -> i > 0))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace !Stream.noneMatch(...) with Stream.anyMatch(...)" "true"
|
||||
// "Replace !Stream.noneMatch(...) with anyMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace Stream.noneMatch(x -> !(...)) with Stream.allMatch(...)" "true"
|
||||
// "Replace Stream.noneMatch(x -> !(...)) with allMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace !IntStream.noneMatch(...) with anyMatch(...)" "true"
|
||||
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
public boolean testNoneMatch(int[] data) {
|
||||
if(IntStream.of(data).anyMatch(i -> i > 0))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace Stream.allMatch(x -> !(...)) with Stream.noneMatch(...)" "false"
|
||||
// "Replace Stream.allMatch(x -> !(...)) with noneMatch(...)" "false"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace Stream.allMatch(x -> !(...)) with Stream.noneMatch(...)" "true"
|
||||
// "Replace Stream.allMatch(x -> !(...)) with noneMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace !Stream.allMatch(x -> !(...)) with Stream.anyMatch(...)" "true"
|
||||
// "Replace !Stream.allMatch(x -> !(...)) with anyMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace DoubleStream.allMatch(x -> !(...)) with noneMatch(...)" "true"
|
||||
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
public boolean testAllMatch(double[] data) {
|
||||
if(DoubleStream.of(data).allM<caret>atch(d -> !Double.isNaN(d)))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace !Stream.anyMatch(...) with Stream.noneMatch(...)" "true"
|
||||
// "Replace !Stream.anyMatch(...) with noneMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace !Stream.anyMatch(x -> !(...)) with Stream.allMatch(...)" "false"
|
||||
// "Replace !Stream.anyMatch(x -> !(...)) with allMatch(...)" "false"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace !Stream.anyMatch(x -> !(...)) with Stream.allMatch(...)" "true"
|
||||
// "Replace !Stream.anyMatch(x -> !(...)) with allMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace !LongStream.anyMatch(...) with noneMatch(...)" "true"
|
||||
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
public boolean testAnyMatch(long[] data) {
|
||||
if(!LongStream.of(data).anyM<caret>atch(i -> i > 0))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Replace !Stream.noneMatch(...) with Stream.anyMatch(...)" "true"
|
||||
// "Replace !Stream.noneMatch(...) with anyMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Replace Stream.noneMatch(x -> !(...)) with Stream.allMatch(...)" "true"
|
||||
// "Replace Stream.noneMatch(x -> !(...)) with allMatch(...)" "true"
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace !IntStream.noneMatch(...) with anyMatch(...)" "true"
|
||||
|
||||
import java.util.stream.*;
|
||||
|
||||
class Test {
|
||||
public boolean testNoneMatch(int[] data) {
|
||||
if(!IntStream.of(data).noneM<caret>atch(i -> i > 0))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user