mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
IDEA-167088 Stream API migration: allow resulting StringBuilder usages in concatenation
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Test {
|
||||
static String test(List<String> list) {
|
||||
String sb;
|
||||
System.out.println("hello");
|
||||
sb = list.stream().filter(s -> !s.isEmpty()).map(String::trim).collect(Collectors.joining());
|
||||
String s = "Result: ";
|
||||
s += sb;
|
||||
System.out.println(s);
|
||||
return "[" + sb + "]";
|
||||
}
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
static String test(List<String> list) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
System.out.println("hello");
|
||||
for(String s : li<caret>st) {
|
||||
if(!s.isEmpty()) {
|
||||
sb.append(s.trim());
|
||||
}
|
||||
}
|
||||
String s = "Result: ";
|
||||
s += sb;
|
||||
System.out.println(s);
|
||||
return "[" + sb + "]";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user