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

Exercise from second lesson (by Narek Karapetian) #166

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

NarekDW
Copy link

@NarekDW NarekDW commented Jul 4, 2017

No description provided.

throw new UnsupportedOperationException();
};
private Predicate<Person> negate1(Predicate<Person> predicate) {
return p -> predicate.negate().test(p);
Copy link
Contributor

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.

Copy link
Author

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);
Copy link
Contributor

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?

Copy link
Author

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;
Copy link
Contributor

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.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

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