done#1411
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The code correctly implements all functional requirements using Stream API, and the logic for filtering, mapping, and reducing is sound. However, there is a consistent violation of the enum comparison requirement across multiple methods. The checklist explicitly states to use .equals() for Enum value comparisons instead of ==, and this applies to selectMenByAge(), getWorkablePeople(), and getCatsNames() methods where person.getSex() == Person.Sex.MAN or woman are used. Since explicit checklist items are violated, changes are needed. Replace all enum comparisons using == with .equals() method calls—for example, change person.getSex() == Person.Sex.MAN to person.getSex().equals(Person.Sex.MAN). The core functionality is working correctly, so once the enum comparisons are fixed, the implementation should be complete.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Important
Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.
Tip
If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.
Caution
Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.
Footnotes
| return peopleList.stream() | ||
| .filter(person -> person.getAge() >= fromAge | ||
| && person.getAge() <= toAge | ||
| && person.getSex() == Person.Sex.MAN) |
There was a problem hiding this comment.
Checklist item #X violation: Use equals() for Enum value comparisons instead of ==. The Sex enum should be compared using .equals() method.
| return Collections.emptyList(); | ||
| return peopleList.stream() | ||
| .filter(person -> person.getAge() >= fromAge) | ||
| .filter(person -> { |
There was a problem hiding this comment.
Checklist item #X violation: Use equals() for Enum value comparisons instead of ==. The Sex enum should be compared using .equals() method.
| .filter(person -> { | ||
| if (person.getSex() == Person.Sex.WOMAN) { | ||
| return person.getAge() <= femaleToAge; | ||
| } |
There was a problem hiding this comment.
Checklist item #X violation: Use equals() for Enum value comparisons instead of ==. The Sex enum should be compared using .equals() method.
| public List<String> getCatsNames(List<Person> peopleList, int femaleAge) { | ||
| return Collections.emptyList(); | ||
| return peopleList.stream() | ||
| .filter(person -> person.getSex() == Person.Sex.WOMAN |
There was a problem hiding this comment.
Checklist item #X violation: Use equals() for Enum value comparisons instead of ==. The Sex enum should be compared using .equals() method.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution meets all requirements and all previously identified issues have been successfully resolved. The enum comparison violations have been fixed - all methods now correctly use ".equals()" for comparing enum values, and the constants for age thresholds and other magic values are properly defined in CandidateValidator. The Stream API is used correctly throughout all six tasks, edge cases are handled with appropriate exceptions, and all checklist items are satisfied. The implementation is clean, well-structured, and functional. Great work on addressing the feedback and getting everything working correctly!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.