Check out example codes for "java stream and filter". It will help you in understanding the concepts better.

Code Example 1

List<String> result = lines.stream()               
                .filter(line -> "theLineIWant".equals(line))
                .collect(Collectors.toList());

Code Example 2

items.stream()
	.filter(s->s.contains("B"))
	.forEach(System.out::println);

Learn ReactJs, React Native from akashmittal.com