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

Code Example 1
package com.ricky.java8;

import java.util.Arrays;
import java.util.List;

public class NowJava8 {

    public static void main(String[] args) {

        List<String> lines = Arrays.asList("spring", "node", "ricky");

        List<String> result =                // convert list to stream
                .filter(line -> !"ricky".equals(line))     // we dont like ricky
                .collect(Collectors.toList());              // collect the output and convert streams to a List

        result.forEach(System.out::println);                //output : spring, node



Learn ReactJs, React Native from