-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
base: main
Are you sure you want to change the base?
Stream API using #914
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nonpareil job)
There was a problem hiding this 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
.filter(person -> person.getSex().equals(Person.Sex.MAN) | ||
&& fromAge <= person.getAge() | ||
&& toAge >= person.getAge()) |
There was a problem hiding this comment.
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
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())); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
No description provided.