Filter Stream With List Java Code Example

Snippet 1
  items.stream()
	.filter(s->s.contains("B"))
	.forEach(System.out::println); 
Snippet 2
  List result = lines.stream()               
                .filter(line -> "theLineIWant".equals(line))
                .collect(Collectors.toList());