I have this POJO. Also, I have a List of Students and I want to filter with stream which registers have in his schoolname the text santa. In SQL it would be something like this: LIKE %SANTA%
public class Student {
private String name;
private String lastName;
private String city;
private String schoolname;
private String telephone;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getSchoolname() {
return schoolname;
}
public void setSchoolname(String schoolname) {
this.schoolname = schoolname;
}
public String getTelephone() {
return telephone;
}
public void setTelephone(String telephone) {
this.telephone = telephone;
}
}
And I would like to obtain the students which his schoolname contains the string santa, do you know how can I have to do the filter with streams?
I need to do with stream, I can't do it with if and else statements.