ricken07/google-voice-java

Contact does not implement proper equals/hashCode method

Opened this issue · 0 comments

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: