Assume you have some objects which have several fields they can be compared by:
public class Person { private String firstName; private String lastN
Its easy to do using Google's Guava library.
e.g. Objects.equal(name, name2) && Objects.equal(age, age2) && ...
Objects.equal(name, name2) && Objects.equal(age, age2) && ...
More examples: