I have 2 lists:
- List1: - Object1 (Empno1, Empname1,Salary1)
- List2: - Object2(Empno2, Empname2,Salary2) Object3(Empno3, Empname3,Salary3)
Given the size of List1 is not same as List2.
I want to iterate over the List1 and List2, if the Empno in List1 object is same as Empno of List2 Object then we have to validate Empname in List1 object is same as Empname of List2 Object
here is the code using old java:
boolean flag=false;
  for(Object1 obj1:list1) {
    for(Object2 obj2:list2) {
      if(obj1.getEmpno()==obj2.getEmpno()) {
         if(obj1.getEmpname().equals(obj2. getEmpname())){
          flag=true;
      }
     }
   }
}
Which is the best way to implement this with java8
 
     
     
    