i have two generic value of type emp and principle emp pojo
class emp
{
Private String name;
Private String Phone;
Private Designation;
//setters and getters
}
principle pojo
class principle
{
Private String name;
Private String lastName;
Private String school;
//setters and getters
}
I am having two list
List<emp> list=new ArrayList<emp>();
list=dao.getData();
List<principle> list1=new ArrayList<principle>();
list1=dao.getDataOfprinciple();
i have tried something like this
List<emp> list3=new ArrayList<emp>();
for(emp e:list)
{
for(principle p:list1)
{
String x=e.getName();
String y=p.getName();
if(x==y)
break;
Reader reader=new Reader();
reader.setMfrPn(r.getMfrPn());
reader.setMfrName(r.getMfrName());
list3.add(r);
}
}
how do I find the list of emp
which are not matching with
principle
list with respect to name and I have to store the list in new list of type emp