How to use Streams filter in Java?

Here is a some example to explain how to use Filter by Streams in java 8

we need the Class Person for our example.

package com.nourit.java8.Streams;

public class Person {
  private int id;
  private String name;
  private String firstname;
  private String country;

  public Person(int id, String firstname, String name, String country) {
    this.id = id;
    this.name = name;
    this.firstname = firstname;
    this.country = country;
  }

  public int getId() {
    return id;
  }
  public void setId(int id) {
    this.id = id;
  }
  public String getName() {
    return name;
  }
  public void setName(String name) {
    this.name = name;
  }
  public String getFirstname() {
    return firstname;
  }

  public void setFirstname(String firstname) {
    this.firstname = firstname;
  }
  public String getCountry() {
    return country;
  }
  public void setCountry(String country) {
    this.country = country;
  }
}

First example coming ..




NOUR-IT

IT Training Center for Java and Web technology. If you enjoy and like our tutorials and believe in our mission, Please Subscribe us on Youtube and follow us on Twitter, or befriend us on Facebook or Google Plus.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

*