FuseStreamOperationsInspection: fixes according to review IDEA-CR-24873

1. Code sample in description
2. Supported toCollection with parameterized method-reference
This commit is contained in:
Tagir Valeev
2017-09-27 10:50:03 +07:00
parent f065fa4778
commit 1779a8a871
4 changed files with 37 additions and 4 deletions
@@ -0,0 +1,12 @@
// "Fuse ArrayList into the Stream API chain" "true"
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Test {
void test(Stream<String> stream) {
List<Object> objects = stream.distinct().collect(Collectors.toList());
}
}
@@ -0,0 +1,12 @@
// "Fuse ArrayList into the Stream API chain" "true"
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Test {
void test(Stream<String> stream) {
List<Object> objects = new ArrayList<>(stream.co<caret>llect(Collectors.toCollection(LinkedHashSet<Object>::new)));
}
}