Creating a Comparator using comparing method

suggest 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:


Reversed order

To create a comparator that imposes the reverse ordering use reversed() method:


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.

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents