0

The following is the code which normally write to iterate and based on some condtion,i am adding to some other list.How can i write the same in the Lambdaj. Thanks in advance and your suggestion is appreciable.

List<Person> authorizedPerson = new ArrayList<Person>();
 for(Person person : Pesrsons) {
  if(person .getAuthorized()) {
    authorizedPerson.add(person);
   }
}
srini
  • 6,719
  • 8
  • 32
  • 36

1 Answers1

1

The following is the answer for the above,I investigated and found the solution, If it is wrong please correct me.

 List<Person> authorizedPesrson = select(persons, having(on(Person.class).getAuthorized().equals(true)));
srini
  • 6,719
  • 8
  • 32
  • 36