IDEA-182623 Replace with collect swallows comments

This commit is contained in:
Tagir Valeev
2017-11-27 15:22:26 +07:00
parent 5b8f3b2bfe
commit 5b36191d2c
29 changed files with 306 additions and 263 deletions
@@ -6,6 +6,9 @@ import java.util.stream.Collectors;
public class Test {
private static String work2(List<String> strs) {
String sb = strs.stream().collect(Collectors.joining(",", "{", "}"));
// before
// after
// inside
return sb;
}
}
@@ -5,14 +5,14 @@ import java.util.List;
public class Test {
private static String work2(List<String> strs) {
StringBuilder sb = new StringBuilder();
sb.append("{");
sb.append("{"); // before
String separator = "";
for <caret> (String str : strs) {
sb.append(separator);
sb.append(separator); // inside
sb.append(str);
separator = ",";
}
sb.append("}");
sb.append("}"); // after
return sb.toString();
}
}