IDEA-160802 Add inspection to optimize ...flatMap(Collection::stream).count() to ...mapToLong(Collection::size).sum();

New inspection along with Collection.stream().count() -> Collection.size() moved to separate file ReplaceInefficientStreamCountInspection
This commit is contained in:
Tagir Valeev
2016-09-07 15:20:43 +07:00
parent 70c9a795e4
commit bef996aa8b
13 changed files with 323 additions and 40 deletions
@@ -0,0 +1,12 @@
// "Replace Stream.flatMap().count() with Stream.mapToLong().sum()" "true"
import java.util.Collection;
import java.util.List;
public class Main {
private String s;
public Main(List<List<String>> s) {
long count = s.stream().mapToLong(Collection::size).sum();
}
}