Skip to content

write own impl of Predicate in CandidateValidator and implement metho…#1397

Open
polina-kirf wants to merge 1 commit into
mate-academy:mainfrom
polina-kirf:main
Open

write own impl of Predicate in CandidateValidator and implement metho…#1397
polina-kirf wants to merge 1 commit into
mate-academy:mainfrom
polina-kirf:main

Conversation

@polina-kirf

Copy link
Copy Markdown

…ds in StreamPractice

@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 because it correctly implements all required functionality using the Stream API, including the minimum even number search, odd numbers average with proper exception behavior, and all the people/candidates filtering rules as described. The CandidateValidator correctly enforces age (35+), nationality, voting permission, and total years in Ukraine based on the parsed periodsInUkr string, and validateCandidates reuses this predicate and returns sorted names.

There are no critical or blocking issues to fix for this task. As a minor polish, the Javadoc for validateCandidates currently says candidates must be "older than 35 years", while your code checks age >= 35; consider rewording this to something like "at least 35 years old" so the documentation matches the logic. Another optional improvement: in CandidateValidator, the loop that parses and sums periodsInUkr is clear and correct, but you could experiment with converting this to a stream-based summation for stylistic consistency with the rest of your stream-heavy code.

Overall, you met the task requirements well, used streams appropriately (no loops in StreamPractice), and followed the checklist items such as proper exception messages, enum comparison with ==, and avoiding magic numbers via constants. Nice work—these are solid, idiomatic stream solutions and a good use of Predicate<Candidate> for reusable validation.


✨ 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