mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-18 17:20:54 +07:00
18 lines
493 B
Java
18 lines
493 B
Java
// "Collapse loop with stream 'findFirst()'" "true-preview"
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
|
|
public class Main {
|
|
public void testMap(Map<String, List<String>> map) throws Exception {
|
|
int firstSize;
|
|
int other = map.size();
|
|
if(other > 10) {
|
|
System.out.println("Big");
|
|
}
|
|
// comment
|
|
firstSize = map.values().stream().filter(Objects::nonNull).findFirst().map(List::size).orElse(0);
|
|
System.out.println(firstSize);
|
|
}
|
|
} |