Files
2022-12-23 13:26:29 +00:00

11 lines
366 B
Java

// "Collapse loop with stream 'count()'" "true-preview"
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Set;
public class Main {
public void test(List<Set<String>> nested) {
int count = (int) nested.stream().filter(Objects::nonNull).flatMap(Collection::stream).filter(str -> str.startsWith("xyz")).count();
}
}