mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-30 18:28:55 +07:00
14 lines
357 B
Java
14 lines
357 B
Java
// "Collapse loop with stream 'count()'" "true-preview"
|
|
import java.util.List;
|
|
import java.util.Set;
|
|
|
|
public class Main {
|
|
public void test(List<Set<String>> nested) {
|
|
int count = 0;
|
|
for(Set<String> element : nested) {
|
|
if(element != null) {
|
|
count += element.stream().filter(str -> str.startsWith("xyz")).count();
|
|
}
|
|
}
|
|
}
|
|
} |