JoiningMigration: remove unnecessary side effect check for prefix: IDEA-207456

This commit is contained in:
Roman.Ivanov
2019-04-09 12:34:13 +07:00
parent 5c6340695a
commit 970afc84ff
3 changed files with 87 additions and 30 deletions
@@ -0,0 +1,12 @@
// "Replace with collect" "true"
import java.util.List;
import java.util.stream.Collectors;
public class Test {
static String test(List<String> list) {
String sb = list.stream().filter(s -> !s.isEmpty()).map(String::trim).collect(Collectors.joining("", "asdsad" + "bar", ""));
//comment
return sb.length() == 0 ? null : sb;
}
}
@@ -0,0 +1,17 @@
// "Replace with collect" "true"
import java.util.List;
public class Test {
static String test(List<String> list) {
StringBuilder sb = new StringBuilder();
sb.append("asdsad").append("bar");
for(String s : li<caret>st) {
if(!s.isEmpty()) {
sb.append(s.trim());
}
}
return sb.length() == 0 ? null : sb.toString//comment
();
}
}