How to compare?
class A
{
B b;
ArrayList aobj;
}
class B
{
ArrayList bobj;
}
Now,
A Object1=new A();
A Object2=new A();
Object1 == Object2 ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You would need to overload the
== operatorforClass A. The exact implementation depends on how you would want to define==, but typically this would be a attribute by attribute comparison. So for you case check if the b members are equal and then check if the ArrayList are equal in length and have same elements.