Skip to content

Result of the task#1403

Open
MerZakhar wants to merge 2 commits into
mate-academy:mainfrom
MerZakhar:my-jv-stream-practice
Open

Result of the task#1403
MerZakhar wants to merge 2 commits into
mate-academy:mainfrom
MerZakhar:my-jv-stream-practice

Conversation

@MerZakhar

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

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

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

String[] parts = c.getPeriodsInUkr().split("-");
int start = Integer.parseInt(parts[0]);
int end = Integer.parseInt(parts[1]);
return c.getAge() >= 35

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

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 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;

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

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

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

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 uses == to compare enum values. Checklist item #C2 requires using equals() method instead of == for Enum comparisons.

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

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