📜  java流代码忽略null - Java代码示例

📅  最后修改于: 2022-03-11 14:52:10.887000             🧑  作者: Mango

代码示例1
List result = Arrays.asList("Java", "Stream", null, "Filter", null);
result.stream().filter(str -> str != null).forEach(System.out::println)
// OR
Stream result = Stream.of("java", null, "python", "devops", null);
result.filter(str -> str != null).forEach(System.out::println)