Skip to content

Contact does not implement proper equals/hashCode method #47

@GoogleCodeExporter

Description

@GoogleCodeExporter
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 [email protected] on 4 Mar 2013 at 2:34

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions