Skip to content

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