StreamToLoop: support parentheses inside flatMap

This commit is contained in:
Tagir Valeev
2018-09-19 12:26:21 +07:00
parent 65049765b0
commit 85f0872d9b
2 changed files with 8 additions and 7 deletions

View File

@@ -16,12 +16,12 @@ public class Main {
public static void testComplexFilter(List<String> list) {
System.out.println(list.stream()
.filter(x -> x != null)
.flatMap(s -> IntStream.range(0, 10).boxed().filter(Predicate.isEqual(s.length())))
.flatMap(s -> (IntStream.range(0, 10).boxed().filter(Predicate.isEqual(s.length()))))
.collect(Collectors.toList()));
}
public void testConditional(List<List<String>> list) {
list.stream().flatMap(lst -> lst == null ? Stream.empty() : lst.stream()).forEach(System.out::println);
list.stream().flatMap(lst -> lst == null ? (Stream.empty()) : (lst.stream())).forEach(System.out::println);
}
private static long testDistinctUnpluralize(List<List<String>> nested) {