mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
Simplify Stream API call chain inspection improvements: IDEA-179118
This commit is contained in:
+13
@@ -0,0 +1,13 @@
|
||||
// "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("", "1" + 2, ""));
|
||||
return sb.length() == 0 ? null : sb;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Test {
|
||||
static String test(List<String> list, StringBuilder sb) {
|
||||
sb.append(list.stream().filter(s -> !s.isEmpty()).map(String::trim).collect(Collectors.joining()));
|
||||
return sb.length() == 0 ? null : sb.toString();
|
||||
}
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
static String test(List<String> list) {
|
||||
StringBuilder sb = new StringBuilder().append("1").append(2);
|
||||
System.out.println("hello");
|
||||
for(String s : li<caret>st) {
|
||||
if(!s.isEmpty()) {
|
||||
sb.append(s.trim());
|
||||
}
|
||||
}
|
||||
return sb.length() == 0 ? null : sb.toString();
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
// "Replace with collect" "true"
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
static String test(List<String> list, StringBuilder sb) {
|
||||
for(String s : li<caret>st) {
|
||||
if(!s.isEmpty()) {
|
||||
sb.append(s.trim());
|
||||
}
|
||||
}
|
||||
return sb.length() == 0 ? null : sb.toString();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user