mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-06-13 20:37:16 +07:00
IDEA-167088 Stream API migration: intermediate mapping added
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ public class Test {
|
||||
static String test(List<String> list) {
|
||||
String sb;
|
||||
System.out.println("hello");
|
||||
sb = list.stream().filter(s -> !s.isEmpty()).collect(Collectors.joining());
|
||||
sb = list.stream().filter(s -> !s.isEmpty()).map(String::trim).collect(Collectors.joining());
|
||||
return sb.length() == 0 ? null : sb;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -4,10 +4,10 @@ import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Test {
|
||||
static String test(List<String> list) {
|
||||
static String test(List<Integer> list) {
|
||||
String sb = "";
|
||||
if(!list.isEmpty()) {
|
||||
sb = list.stream().filter(s -> !s.isEmpty()).collect(Collectors.joining());
|
||||
sb = list.stream().filter(i -> i != 0).map(String::valueOf).collect(Collectors.joining());
|
||||
}
|
||||
String s = sb;
|
||||
return s.trim();
|
||||
|
||||
+1
-1
@@ -8,7 +8,7 @@ public class Test {
|
||||
System.out.println("hello");
|
||||
for(String s : li<caret>st) {
|
||||
if(!s.isEmpty()) {
|
||||
sb.append(s);
|
||||
sb.append(s.trim());
|
||||
}
|
||||
}
|
||||
return sb.length() == 0 ? null : sb.toString();
|
||||
|
||||
+4
-4
@@ -3,12 +3,12 @@
|
||||
import java.util.List;
|
||||
|
||||
public class Test {
|
||||
static String test(List<String> list) {
|
||||
static String test(List<Integer> list) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if(!list.isEmpty()) {
|
||||
for (String s : li<caret>st) {
|
||||
if (!s.isEmpty()) {
|
||||
sb.append(s);
|
||||
for (Integer i : li<caret>st) {
|
||||
if (i != 0) {
|
||||
sb.append(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user