mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-28 06:51:01 +07:00
14 lines
436 B
Java
14 lines
436 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 = 0, other = firstSize;
|
|
// comment
|
|
firstSize = map.values().stream().filter(Objects::nonNull).findFirst().map(List::size).orElse(firstSize);
|
|
System.out.println(firstSize);
|
|
}
|
|
} |