The natural order in dates (as defined by compareTo ) is that a later date is "greater than the previous". For seniority, a person who has been there longer is older, i.e. You want an earlier start date to mean a longer experience than a later one.
Since the Comparator contract states that if compare(a,b) != 0 , then compare(a,b) and compare(b,a) should have the opposite sign, you have two options for how to implement the reverse ordered comparison a and b - either return -(a.compareTo(b)) or b.compareTo(a) - they are guaranteed to have the same sign.
They will not necessarily have the same value, but the only thing that matters for the results of the comparator is whether they are > , < or == equal to 0, and in many examples -1 , 0 and +1 any value with the correct icon well.
source share