I have two lists (arrayList1
, arrayList2
) contain duplicate objects.
Ex : Employee ( empname, email, mobile)
Employee e = new Employee();
e.setEmpName("chandu");
e.setEmail("chandu@gmail.com");
e.setMobile("9030128664");
arrayList1.add(e);
Employee e1 = new Employee();
e1.setEmpName("ramesh");
e1.setEmail("ramesh@gmail.com");
e1.setMobile("9154618845");
arrayList2.add(e);
arrayList2.add(e1);
In the above lists arrayList1
and arrayList2
contain one same object with same value. I have compared arrayList1
and arrayList2
and if they contains any duplicate elements I want to remove that duplicate element.
Can anyone suggest me how to compate two objects and remove duplicate objects
Note : I want to compare two lists with all the values (empname, email, mobile)