-
Notifications
You must be signed in to change notification settings - Fork 5
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
Implement duplicate email checking feature #53
Implement duplicate email checking feature #53
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
|
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.
LGTM! This should be sufficient to check if a Person has the same name and email as one in the list.
@@ -33,7 +33,7 @@ public class UniquePersonList implements Iterable<Person> { | |||
*/ | |||
public boolean contains(Person toCheck) { | |||
requireNonNull(toCheck); | |||
return internalList.stream().anyMatch(toCheck::isSamePerson); | |||
return internalList.stream().anyMatch(toCheck::hasDuplicateInfo); |
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 should check if the list has any Person with the same email and name
* This is to avoid adding duplicate contact in the contact list. | ||
*/ | ||
public boolean hasDuplicateInfo(Person otherPerson) { | ||
return this.isSamePerson(otherPerson) || this.hasSameEmail(otherPerson); |
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 checks for both the name and the email
Fix #45