I have two array list. Each has list of Objects of type User.
The User class looks like below
public class User {
private long id;
pri
The canonical approach is as follows:
countDifferences
that counts the number of differences between usersIf you put weights on the different properties you can also control that e.g. a match in the ID attribute is stronger than a match in the name.
Update: sorry, misread your comment that the ID attribute must match.
Replace 2) with "find object which has the same ID". Other than that, I still recommend counting the number of differences. It is more flexible, as you can define thresholds for good or bad matches etc.