1NowJava8.java
2package com.ricky.java8;
3
4import java.util.Arrays;
5import java.util.List;
6import java.util.stream.Collectors;
7
8public class NowJava8 {
9
10 public static void main(String[] args) {
11
12 List<String> lines = Arrays.asList("spring", "node", "ricky");
13
14 List<String> result = lines.stream() // convert list to stream
15 .filter(line -> !"ricky".equals(line)) // we dont like ricky
16 .collect(Collectors.toList()); // collect the output and convert streams to a List
17
18 result.forEach(System.out::println); //output : spring, node
19
20 }
21
22}12345678910111213141516171819202122