mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
StreamToLoop: support condition inside flatMap
This commit is contained in:
+16
@@ -0,0 +1,16 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
public class Main {
|
||||
public void test(List<List<String>> list) {
|
||||
for (List<String> lst : list) {
|
||||
if (lst != null) {
|
||||
for (String s : lst) {
|
||||
System.out.println(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// "Replace Stream API chain with loop" "true"
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.*;
|
||||
|
||||
public class Main {
|
||||
public void test(List<List<String>> list) {
|
||||
list.stream().flatMap(lst -> lst == null ? Stream.empty() : lst.stream()).<caret>forEach(System.out::println);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user