Creating a Comparator using comparing methodsuggest change
This creates a comparator for the class
Person that uses this person name as the comparison source. Also it is possible to use method version to compare long, int and double. For example:
To create a comparator that imposes the reverse ordering use
Chain of comparators
This will create a comparator that firs compares with last name then compares with first name. You can chain as many comparators as you want.