Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stream API using #914

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Conversation

fedorovychh
Copy link

No description provided.

Copy link

@TarasYurkovskyi TarasYurkovskyi left a comment

Choose a reason for hiding this comment

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

Nonpareil job)

Copy link

@mnyshenko mnyshenko left a comment

Choose a reason for hiding this comment

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

Approved, but pay attention to the comments

Comment on lines +46 to +48
.filter(person -> person.getSex().equals(Person.Sex.MAN)
&& fromAge <= person.getAge()
&& toAge >= person.getAge())

Choose a reason for hiding this comment

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

getAge() is used twice so can be extracted to a separate variable

Comment on lines +54 to +56
Predicate<Person> workableFilter = person -> fromAge <= person.getAge()
&& ((person.getSex().equals(Person.Sex.WOMAN) && femaleToAge >= person.getAge())
|| (person.getSex().equals(Person.Sex.MAN) && maleToAge >= person.getAge()));

Choose a reason for hiding this comment

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

getAge() is used twice so can be extracted to a separate variable, same with sex

Function<Integer, Integer> oddSubstractFunction = integer -> {
int index = numbers.indexOf(integer);
int num = index % HALF_DIVISER != REMINDER_DEFAULT ? --integer : integer;
numbers.set(index, null);

Choose a reason for hiding this comment

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

I guess we don't need to change the initial collection; we should just get a value, reduce it, and pass it

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