-
Notifications
You must be signed in to change notification settings - Fork 66
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
Exercise from second lesson (by Narek Karapetian) #166
base: master
Are you sure you want to change the base?
Conversation
throw new UnsupportedOperationException(); | ||
}; | ||
private Predicate<Person> negate1(Predicate<Person> predicate) { | ||
return p -> predicate.negate().test(p); |
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.
Don't use Predicate::negate
here.
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.
Done.
// TODO | ||
throw new UnsupportedOperationException(); | ||
}; | ||
return p -> t1.test(p) & t2.test(p); |
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.
Why not &&
? What is the difference between these operators? Are you sure you need &
here?
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.
Using && here is more correctly, you are right. I just mixed up the functionality between && and &.
In this case if t1.test(p)
is false operator && won't call the second expression couse it's senselessly.
new Person("aa", "b", 1))); | ||
} | ||
} | ||
package lambda.part2.exercise; |
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.
This diff is unreadable. I suspect you've changed line endings.
Fix it.
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.
Done.
No description provided.