Skip to content

Develop#1389

Open
PatrykWski wants to merge 5 commits into
mate-academy:mainfrom
PatrykWski:develop
Open

Develop#1389
PatrykWski wants to merge 5 commits into
mate-academy:mainfrom
PatrykWski:develop

Conversation

@PatrykWski

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

public int findMinEvenNumber(List<String> numbers) {
return 0;
return numbers.stream()
.filter(number -> number.contains(","))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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())) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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! ✨

Footnotes

  1. Rate AI review example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants