1List<String> result = Arrays.asList("Java", "Stream", null, "Filter", null);
2result.stream().filter(str -> str != null).forEach(System.out::println)
3// OR
4Stream<String> result = Stream.of("java", null, "python", "devops", null);
5result.filter(str -> str != null).forEach(System.out::println)