mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 01:09:46 +07:00
15 lines
464 B
Java
15 lines
464 B
Java
// "Collapse loop with stream 'findFirst()'" "true-preview"
|
|
|
|
import java.util.ArrayList;
|
|
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 {
|
|
List<String> firstList = new ArrayList<>();
|
|
firstList.add("none");
|
|
firstList = map.values().stream().filter(Objects::nonNull).findFirst().orElse(firstList);
|
|
System.out.println(firstList);
|
|
}
|
|
} |