Java 8 – Filter a null value from a Stream
package com.mkyong.java8;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class Java8Examples {
public static void main(String[] args) {
Stream
//List
List
result.forEach(System.out::println);
}
}
output
java
python
node
ruby
php
Alternatively, filter with Objects::nonNull
import java.util.List;
List
http://www.mkyong.com/java8/java-8-filter-a-null-value-from-a-stream/