Filer List with Lambda - Java Lambda Stream

Java examples for Lambda Stream:Predicate

Description

Filer List with Lambda

Demo Code



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

public class SimpleMain {
  public static void main(String[] args) {
    List<String> lst = Arrays.asList("Aman", "varun", "Sonu");
    lst.stream()                //lst is Source
    .filter(p->p.contains("a"))          //Condition if any
    .forEach((p) -> System.out.println(p));    //Output
  }//ww w  . java  2  s. c om
}

Related Tutorials