StreamApiMigrationInspection: enable flatMap with primitive type change

This commit is contained in:
Tagir Valeev
2017-01-12 11:18:29 +07:00
parent 0957d52585
commit 347bd66e81
4 changed files with 42 additions and 10 deletions
@@ -0,0 +1,13 @@
// "Replace with count()" "true"
import java.util.Arrays;
import java.util.function.Function;
import java.util.stream.IntStream;
import java.util.stream.LongStream;
import java.util.stream.Stream;
public class Test {
public void test() {
long count = IntStream.range(0, 10).mapToObj(i -> LongStream.range(0, i)).flatMapToLong(Function.identity()).mapToObj(l -> Stream.of("x", "y", "z")).flatMap(Function.identity()).flatMapToInt(s -> IntStream.range(0, s.length())).count();
System.out.println(count);
}
}
@@ -0,0 +1,18 @@
// "Replace with count()" "true"
import java.util.Arrays;
public class Test {
public void test() {
long count = 0;
for(int <caret>i=0; i<10; i++) {
for(long l = 0; l < i; l++) {
for(String s : Arrays.asList("x", "y", "z")) {
for(int k = 0; k < s.length(); k++) {
count++;
}
}
}
}
System.out.println(count);
}
}