First of all, I would like to say that I have searched for an answer to this, but did not get an suitable solution. So I have decided to post it here.
I have an ArrayList of Objects (ArrayList(Provider)). The Provider Object has First Name, Last Name, NPI Number, List (I have not listed all the fields).
Provider {
private long providerId;
private String npiNumber;
private PersonName providerName;
private List<Address> providerAddresses;
}
Now I want to find if the ArrayList has duplicates based on these attributes (First Name, Last Name, NPI, Addresses). Each Provider will have 2 addresses. The issue we have is the Provider Object is generated from XSD and cannot be modified. So I cannot override the equals and hashcode methods. So The Hashset(list) does not work.
So what is the best way to check if the ArrayList has duplicate objects. Please let me know
Thanks
Harish