IDEA-185812 Allow to force explicit toCollection(ArrayList::new) instead of toList() in "Subsequent steps can be fused into Stream API"

This commit is contained in:
Tagir Valeev
2018-02-01 17:16:04 +07:00
parent 783ad20e44
commit f06e8ca2f0
7 changed files with 94 additions and 55 deletions
@@ -0,0 +1,18 @@
// "Fix all 'Subsequent steps can be fused into Stream API chain' problems in file" "true"
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Test {
interface Foo {
}
// IDEA-179303
void test1(Stream<Foo> fooStream) {
ArrayList<Foo> collectedFoos = fooStream.collect(Collectors.toCollection(ArrayList::new));
}
void test2(Stream<Foo> fooStream) {
List<Foo> collectedFoos = fooStream.collect(Collectors.toCollection(ArrayList::new));
}
}
@@ -0,0 +1,18 @@
// "Fix all 'Subsequent steps can be fused into Stream API chain' problems in file" "true"
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Test {
interface Foo {
}
// IDEA-179303
void test1(Stream<Foo> fooStream) {
ArrayList<Foo> collectedFoos = new ArrayList<>(fooStream.co<caret>llect(Collectors.toList()));
}
void test2(Stream<Foo> fooStream) {
List<Foo> collectedFoos = new ArrayList<>(fooStream.collect(Collectors.toList()));
}
}