Skip to content

done#1398

Open
plvkIvan wants to merge 2 commits into
mate-academy:mainfrom
plvkIvan:my-solution
Open

done#1398
plvkIvan wants to merge 2 commits into
mate-academy:mainfrom
plvkIvan:my-solution

Conversation

@plvkIvan

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

Your implementation has three critical checklist violations that must be fixed before approval: 1. Exception message format is incorrect — The checklist specifies the exact message as "Can't get min value from list: " + numbers (note the space before numbers). Your current implementation is missing this space, which will cause test failures. 2. Enum comparison using == instead of equals() — Tasks 3 and 4 use p.getSex() == Person.Sex.MAN. The checklist explicitly states to use equals() for comparing Enum values. Change to p.getSex().equals(Person.Sex.MAN). 3. Inclusive age comparison incorrect — Task 5 uses p.getAge() > femaleAge but the requirement clearly states "from femaleAge years old inclusively". This should be p.getAge() >= femaleAge. A minor improvement to consider: in CandidateValidator, the split(",") method doesn't handle whitespace, so inputs like "0, 22, 7" will fail with NumberFormatException. Consider using split(",\s*") or adding .map(String::trim). The core logic and stream usage are solid — these fixes are straightforward checklist compliance issues.


✨ 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

Comment on lines +25 to +26
.orElseThrow(() -> new RuntimeException(
"Can't get min value from list:" + numbers));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing space in exception message. Checklist requires: "Can't get min value from list: " + numbers (with space before 'numbers')

Comment on lines +53 to +54
return peopleList.stream()
.filter(p -> p.getSex() == Person.Sex.MAN

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Checklist states: 'Pay attention to what is a better way to compare Enum values: equals() vs ==?' Use equals() instead of == for Sex enum comparison.

Comment on lines +72 to +74
.filter(p -> p.getAge() >= fromAge)
.filter(p -> (p.getSex() == Person.Sex.MAN && p.getAge() <= maleToAge)
|| (p.getSex() == Person.Sex.WOMAN && p.getAge() <= femaleToAge))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Use equals() instead of == for Sex enum comparison.

public List<String> getCatsNames(List<Person> peopleList, int femaleAge) {
return Collections.emptyList();
return peopleList.stream()
.filter(p -> p.getSex() == Person.Sex.WOMAN && p.getAge() > femaleAge)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Task description says 'from femaleAge years old inclusively' but code uses > instead of >=. Should be p.getAge() >= femaleAge

Comment on lines +20 to +21
&& candidate.getNationality().equals(REQUIRED_NATIONALITY)
&& yearInUkraine >= MIN_YEARS_IN_UKRAINE;

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 split(",") doesn't handle whitespace. Input like "0, 22, 7" will produce strings with leading spaces that Integer::parseInt can't handle. Consider using split(",\s*") or adding .map(String::trim).

@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

Your solution is approved. All critical checklist violations from the previous review have been successfully resolved: enum comparisons now properly use ".equals()" instead of "==", inclusive age ranges correctly use ">=" operators, and exception messages include the required spacing. The implementation demonstrates solid understanding of Stream API with proper predicate composition, correct handling of edge cases like empty streams, and clean separation of concerns with constants in CandidateValidator. All six tasks pass their requirements, and the code follows the specified checklist guidelines throughout. Great work on addressing all the feedback and improving your implementation!


✨ 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