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

Contact does not implement proper equals/hashCode method #47

Open
GoogleCodeExporter opened this issue Apr 11, 2015 · 0 comments
Open

Comments

@GoogleCodeExporter
Copy link

The current (trunk) contact class doesn't implement equals, which makes the 
Contact class difficult to use inside of collections.


The ID that Google uses is stable, but the API doesn't always parse this ID 
(for some reason) but a same-type equality method is easy to add (and is 
trivial) by using the phone number. Patch attached.

The hashCode method is also implemented so that Contacts can be stored in 
HashMaps.

Obviously, these methods should use Google's ID... because I imagine one 
contact could have two different phone numbers. However, it should be true that 
if two contacts have the same phone number, they are the same contact.

Original issue reported on code.google.com by ryan@rmarcus.info on 4 Mar 2013 at 2:34

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant