i'm working on a filter function that can filter with many parameters and to do that i'm using Java Streams. So that is my code :
public void filter(String cours,String prof,String salle,String group) {
this.appointments().addAll(getTimeTable().getCreneauxsList().stream()
.filter(e->e.getProf().equalsIgnoreCase(prof) )
.filter(e->e.getCours().equalsIgnoreCase(cours) )
.filter(e->e.getSalle().equalsIgnoreCase(salle) )
.filter(e->e.getGroup().equalsIgnoreCase(group) )
.collect(Collectors.toList()));
}
I want to see if one or many the parameters cours,salle,prof,group are null or its trim () = "", it's not worth it to filter with it cause the result is not what i expected to get.
But I do not know how to do it.