Skip to content

Maksym Gorodnychyi#1417

Open
MaksymGorodnychyi wants to merge 5 commits into
mate-academy:mainfrom
MaksymGorodnychyi:main
Open

Maksym Gorodnychyi#1417
MaksymGorodnychyi wants to merge 5 commits into
mate-academy:mainfrom
MaksymGorodnychyi:main

Conversation

@MaksymGorodnychyi

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

I am requesting changes because there are still critical requirement mismatches that affect core functionality. First, in CandidateValidator.java, the age check uses candidate.getAge() > MIN_AGE with MIN_AGE = 35, which rejects 35‑year‑old candidates even though the requirement says candidates must be at least 35; this must be changed to candidate.getAge() >= MIN_AGE to meet the task description. Second, in StreamPractice.java (within getOddNumsAverage), you are using the bitwise pattern (value & 1) to check parity, which explicitly conflicts with the checklist warning about distinguishing bitwise and boolean operators; you should replace those conditions with clearer modulo-based checks like value % 2 != 0. Both of these issues are considered critical: the first breaks the specified business rule for candidate eligibility, and the second violates a direct checklist requirement for this task.

Aside from these points, your stream usage, exception messages, reuse of CandidateValidator, and overall logic for the other methods look correct and align well with the requirements. After adjusting the age comparison and replacing the bitwise parity checks, your solution should fully satisfy both the functional description and the checklist expectations.


✨ 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

int startYear = Integer.parseInt(years[0]);
int endYear = Integer.parseInt(years[1]);
int yearsInUkraine = endYear - startYear;
return candidate.getAge() > MIN_AGE

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 violates the requirement that "person should be at least 35 years old". Using > means candidates who are exactly 35 are rejected; change this to candidate.getAge() >= MIN_AGE to satisfy the description and checklist expectations.

@@ -14,7 +18,14 @@ public class StreamPractice {
* "Can't get min value from list: < Here is our input '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.

The task says the person should be at least 35 years old, but here you use > with MIN_AGE = 35, which excludes 35-year-old candidates; this violates the description requirement for inclusive age bounds.

public Double getOddNumsAverage(List<Integer> numbers) {
return 0D;
return IntStream.range(0, numbers.size())
.map(i -> (i & 1) == 1 ? numbers.get(i) - 1 : numbers.get(i))

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 checklist item "Remember about the difference between bitwise and boolean operators" is violated here: using & 1 for parity is a bitwise trick discouraged by the checklist; prefer % 2 or another clearer boolean expression.

return 0D;
return IntStream.range(0, numbers.size())
.map(i -> (i & 1) == 1 ? numbers.get(i) - 1 : numbers.get(i))
.filter(n -> (n & 1) == 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same checklist issue as line 38: using & 1 for parity relies on bitwise behavior rather than a straightforward boolean modulo check, which the checklist asks you to avoid.

@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

I am requesting changes because there is still one critical checklist violation that is treated as a blocker for this task. In src/main/java/practice/StreamPractice.java, the getOddNumsAverage method uses bitwise operators for parity checks, e.g. (i & 1) == 1 and (n & 1) == 1, which goes against the explicit requirement to “remember about the difference between bitwise and boolean operators.” To comply, replace these with clearer boolean/modulo-based checks such as i % 2 != 0 for odd indices and n % 2 != 0 for filtering odd numbers; this keeps the intent purely boolean and matches the checklist. Apart from that, your use of streams, exception handling in findMinEvenNumber, and CandidateValidator implementation all look correct and aligned with the requirements. As a minor improvement, also fix the Checkstyle issues: reorder imports in CandidateValidator.java so java.util imports come before project imports, and split the long line in StreamPractice.java to stay under 100 characters. Once you update the parity checks and clean up these style issues, your solution should be fully acceptable.


✨ 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 Double getOddNumsAverage(List<Integer> numbers) {
return 0D;
return IntStream.range(0, numbers.size())
.map(i -> (i & 1) == 1 ? numbers.get(i) - 1 : numbers.get(i))

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 line violates the checklist item: Remember about the difference between bitwise and boolean operators. Using (i & 1) == 1 for checking odd indices is a bitwise pattern; replace it with a clearer boolean/modulo-based check such as i % 2 != 0 to comply with the requirement.

return 0D;
return IntStream.range(0, numbers.size())
.map(i -> (i & 1) == 1 ? numbers.get(i) - 1 : numbers.get(i))
.filter(n -> (n & 1) == 1)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same checklist issue here: Remember about the difference between bitwise and boolean operators. (n & 1) == 1 is using bitwise operations to test parity; switch to something like n % 2 != 0 so the intent is clearly boolean and matches the checklist guidance.

@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 six tasks are correctly implemented using the Stream API only, without loops, and methods like findMinEvenNumber and getOddNumsAverage follow the required behavior and exception/message formats. CandidateValidator is nicely encapsulated, uses constants instead of magic numbers, correctly implements Predicate<Candidate>, and is reused cleanly in validateCandidates to keep the stream pipeline readable. Enum comparisons are done with ==, and your stream chains are formatted clearly with one operation per line, which improves readability and matches typical style expectations. I don’t see any functional or checklist issues remaining, so there’s nothing that needs fixing at this point. Well done applying prior feedback so thoroughly and producing clean, idiomatic stream-based code—this is solid work to build on in future tasks.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

@Elena-Bruyako Elena-Bruyako 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.

please, fix build first
always check build before sending PR to review

@Elena-Bruyako Elena-Bruyako 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.

Good job

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.

3 participants