CollectMigration: prepare to IncorporateStreamOperationsInspection; fix NewListTerminal to support collections only

This commit is contained in:
Tagir Valeev
2017-09-26 09:29:37 +07:00
parent a78e401ec1
commit fa6bbd0b5d
3 changed files with 48 additions and 10 deletions
@@ -0,0 +1,16 @@
// "Replace with collect" "true"
import java.util.*;
import java.util.stream.Collectors;
public class Test {
MyObj test(List<String> list) {
List<String> res = list.stream().filter(s -> !s.isEmpty()).collect(Collectors.toList());
return new MyObj(res);
}
private class MyObj {
public MyObj(List<String> res) {
}
}
}
@@ -0,0 +1,20 @@
// "Replace with collect" "true"
import java.util.*;
public class Test {
MyObj test(List<String> list) {
List<String> res = new ArrayList<>();
for (String s : li<caret>st) {
if(!s.isEmpty()) {
res.add(s);
}
}
return new MyObj(res);
}
private class MyObj {
public MyObj(List<String> res) {
}
}
}