Compare 2 Java arraylists of different objects and add the matching rows to a new List
问题 We need to compare 2 arraylists of different objects having some common fields, and then store the matching rows to a new arraylist. I have searched for solutions, but wasn't able to get what I need. List<Person> personList = new ArrayList<Person>(); Person: private String firstName; private String lastName; private String street1; private String street2; private String city; private String stateCode; private String zipCode; List<PersonNpi> npiList = new ArrayList<PersonNpi>(); PersonNpi: