I covered all the conditions for sorting a list for name and salary in desc order and lexicographical comparing a string with same salary using compareTo function.
For this, I maintained two lists of names and salary first sorted them, and traversed again on the sorted list for the same salary to order the names.