Comparator is a comparison function. It is normally used to pass as parameter to sort method that imposes a specific ordering of objects in a container like Arrays or Collections.
There are several different utilities at our disposal to use the Comparator. Below are few articles I have written on several different utilities of Comparator interface.