In this example we will show how to use java.util.Comparator interface. java.util.Comparator is an interface which is used for sorting objects in Java. The compare(Object o1, Object o2) method of Comparator interface needs to be implemented for this purpose, which compares two objects and returns an integer, depending on the comparison: positive, if o1 is […]