Skip to content

Commit

Permalink
fixed-5
Browse files Browse the repository at this point in the history
  • Loading branch information
aniliashenko committed Dec 6, 2024
1 parent bb7bffe commit fefcedb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/practice/StreamPractice.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ public List<Person> getWorkablePeople(int fromAge, int femaleToAge,
*/
public List<String> getCatsNames(List<Person> peopleList, int femaleAge) {
return peopleList.stream()
.filter(person -> person.getSex() == Person.Sex.WOMAN && person.getAge() >= femaleAge)
.filter(person -> person.getSex() == Person.Sex.WOMAN
&& person.getAge() >= femaleAge)
.flatMap(person -> person.getCats().stream())
.map(Cat::getName)
.toList();
Expand Down

0 comments on commit fefcedb

Please sign in to comment.