Invoking this method then it will avoid the risking of NullPointerException when we need to compare two object whether they equal.
1 2 3
Generating hash code with multiple object will be simple. And it also can hash all fields of an Object to get more sensible code value.
ComparisonChain is a fluent idiom and much more readable. less prone to accidental typos, and smart enough not to do more work than it must.
It only performs comparisons until it finds a non-zero result, after which it ignores further input.
1 2 3 4 5 6 7