public ClassA
{
private String firstId;
private String secondId;
public void setFirstId(String firstId) {
this.firstId = firstId;
}
public String
What you are trying to do here in not correct. The 2 objects that you are comparing are not only different objects but are also of different types (ClassA and ClassB) which have no relational at all.
Moreover if you try to compare like this
if(bList.contains(clsA))
As your bList contains objects of type ClassB and clsA is of type ClassA, they will be compared using java.lang.Object class's equals() method.
So x.equals(y) returns true if and only if x and y refer to the same object (x == y has the value true).