Implement the compare() method of PersonComparator class to have natural ordering for name field: the smallest value element should be in the head.
For this task you can use the compareTo() method for string comparison. If this is your code var1.compareTo(var2), the method will return:
- a negative number when
var1 < var2 0when variables are equal- a positive number when
var1 > var2