IDEA-162694 Improve "Merge filter chain" intention

This commit is contained in:
Tagir Valeev
2016-10-20 11:19:25 +07:00
parent 62dc8b8241
commit 74ae9731a8
11 changed files with 150 additions and 28 deletions
@@ -0,0 +1,9 @@
// "Merge filter's chain" "true"
import java.util.stream.LongStream;
public class Main {
void test() {
System.out.println(LongStream.range(0, 100).anyMatch(x -> x > 20 && x < 50));
}
}
@@ -0,0 +1,10 @@
// "Merge filter's chain" "true"
import java.util.List;
import java.util.Objects;
public class Main {
void test(List<String> list) {
list.stream().filter((o) -> Objects.nonNull(o) && o.isEmpty()).forEach(System.out::println);
}
}
@@ -0,0 +1,9 @@
// "Merge filter's chain" "true"
import java.util.stream.IntStream;
public class Main {
void test() {
System.out.println(IntStream.range(0, 100).filter(x -> x > 20 && x < 50).count());
}
}
@@ -0,0 +1,9 @@
// "Merge filter's chain" "true"
import java.util.List;
public class Main {
void test(List<String> list) {
list.stream().filter(s -> s.trim().isEmpty() && s.isEmpty()).forEach(System.out::println);
}
}
@@ -0,0 +1,9 @@
// "Merge filter's chain" "true"
import java.util.stream.LongStream;
public class Main {
void test() {
System.out.println(LongStream.range(0, 100).filter(x -> x > 20).anyM<caret>atch(x -> x < 50));
}
}
@@ -0,0 +1,10 @@
// "Merge filter's chain" "true"
import java.util.List;
import java.util.Objects;
public class Main {
void test(List<String> list) {
list.stream().filter(Objects::nonNull).filt<caret>er(String::isEmpty).forEach(System.out::println);
}
}
@@ -0,0 +1,9 @@
// "Merge filter's chain" "true"
import java.util.stream.IntStream;
public class Main {
void test() {
System.out.println(IntStream.range(0, 100).filter(x -> x > 20).fil<caret>ter(x -> x < 50).count());
}
}
@@ -0,0 +1,9 @@
// "Merge filter's chain" "true"
import java.util.List;
public class Main {
void test(List<String> list) {
list.stream().filte<caret>r(s -> s.trim().isEmpty()).filter(String::isEmpty).forEach(System.out::println);
}
}