Develop#1389
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Great job on implementing the solutions using the Stream API! The code is clean and well-structured. However, a couple of issues need to be addressed before this can be approved.
First, there's a logical error in the findMinEvenNumber method in StreamPractice.java. Your filter .filter(number -> number.contains(",")) incorrectly excludes strings that contain only a single number (e.g., "10"), which is a valid input according to the task description. This causes the method to fail for certain cases.
Additionally, in CandidateValidator.java, the hardcoded string "Ukrainian" should be replaced with a private static final constant to avoid using "magic values", as required by the checklist [CHECKLIST ITEM #6].
Please fix these two points, and I'll be happy to review your work again!
✨ 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
| public int findMinEvenNumber(List<String> numbers) { | ||
| return 0; | ||
| return numbers.stream() | ||
| .filter(number -> number.contains(",")) |
There was a problem hiding this comment.
This filter is too restrictive. The task description states "each element contains 1+ numbers", which means a string in the list could be a single number like "10". This filter would incorrectly exclude such cases because they don't contain a comma.
| @@ -75,6 +105,11 @@ public List<String> getCatsNames(List<Person> peopleList, int femaleAge) { | |||
| * parametrized with Candidate in CandidateValidator. | |||
| */ | |||
| public List<String> validateCandidates(List<Candidate> candidates) { | |||
There was a problem hiding this comment.
The implementation of CandidateValidator used in this method doesn't fully meet the requirements. This violates checklist item #6: 'Use constants ... in class CandidateValidator'. The hardcoded string "Ukrainian" in CandidateValidator should be replaced with a constant.
| if (candidate.getAge() < MIMIMUM_AGE_TO_BE_PRESIDENT) { | ||
| return false; | ||
| } | ||
| if (!"Ukrainian".equals(candidate.getNationality())) { |
There was a problem hiding this comment.
This hardcoded string "Ukrainian" is a "magic value". According to checklist item #6, it's better to declare it as a private static final constant at the top of the class. This improves readability and makes the code easier to maintain.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Excellent work on this iteration! I am approving your solution. You've successfully addressed all the feedback from the previous review, fixing the logic in findMinEvenNumber and correctly using constants in CandidateValidator. Your code now meets all functional requirements, is clean, and effectively uses the Stream API. Great job!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
No description provided.