public ClassA
{
private String firstId;
private String secondId;
public void setFirstId(String firstId) {
this.firstId = firstId;
}
public String
Eventhough content is same they are different objects which doesn't satifsy equal condition. You may need to do explicit a.getfirstId().equals(b.getfirsId()) and a.getscondID().equals(b.getSecondId()) by iterating.
The other possibility may be overriding equals and hashcode methods in both POJO classes. Refer this link for equals/hashcode contract.