rajdeokumarsingh / google-voice-java

Automatically exported from code.google.com/p/google-voice-java
0 stars 0 forks source link

Contact does not implement proper equals/hashCode method #47

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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: