Result of the task#1403
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The code successfully addresses all functional requirements but violates two technical constraints: (1) Using '==' to compare enum values instead of '.equals()' in StreamPractice.java, and (2) Using magic values instead of named constants in CandidateValidator.java. These must be fixed before approval.
✨ 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
| String[] parts = c.getPeriodsInUkr().split("-"); | ||
| int start = Integer.parseInt(parts[0]); | ||
| int end = Integer.parseInt(parts[1]); | ||
| return c.getAge() >= 35 |
There was a problem hiding this comment.
Checklist item #I6 violation: Replace magic number 35 with a named constant (e.g., private static final int MIN_AGE = 35).
| int end = Integer.parseInt(parts[1]); | ||
| return c.getAge() >= 35 | ||
| && c.isAllowedToVote() | ||
| && Objects.equals(c.getNationality(), "Ukrainian") |
There was a problem hiding this comment.
Checklist item #I6 violation: Replace magic string 'Ukrainian' with a named constant.
| return c.getAge() >= 35 | ||
| && c.isAllowedToVote() | ||
| && Objects.equals(c.getNationality(), "Ukrainian") | ||
| && end - start >= 10; |
There was a problem hiding this comment.
Checklist item #I6 violation: Replace magic number 10 with a named constant (e.g., private static final int MIN_YEARS_IN_UKRAINE = 10).
| public List<Person> selectMenByAge(List<Person> peopleList, int fromAge, int toAge) { | ||
| return Collections.emptyList(); | ||
| return peopleList | ||
| .stream() |
There was a problem hiding this comment.
This uses == to compare enum values. Checklist item #C2 requires using equals() method instead of == for Enum comparisons.
| return Collections.emptyList(); | ||
| return peopleList | ||
| .stream() | ||
| .filter(p -> (p.getSex() == Person.Sex.MAN) |
There was a problem hiding this comment.
This uses == to compare enum values. Checklist item #C2 requires using equals() method instead of == for Enum comparisons.
| return Collections.emptyList(); | ||
| return peopleList | ||
| .stream() | ||
| .filter(p -> p.getSex() == Person.Sex.WOMAN |
There was a problem hiding this comment.
This uses == to compare enum values. Checklist item #C2 requires using equals() method instead of == for Enum comparisons.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your solution is approved. All requirements have been successfully implemented: the Stream API is used correctly throughout both files, enum comparisons properly use the ".equals()" method instead of "==", and CandidateValidator.java uses named constants (MIN_AGE, MIN_PERIOD, UKRAINIAN) instead of magic values. All eight functional and technical checklist items pass validation, and there are no critical issues remaining. Great work on addressing the previous feedback—your implementation demonstrates solid understanding of Stream operations and predicate usage.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.