Comparator interface in java
Comparator interface: Comparator interface is defined in java.util package. It has two methods named compare(Object obj1,Object obj2) and equals(Object element). Note: In the case of the Comparator interface, we can sort the elements based on multiple properties. Suppose we have Student class elements with name, class, and rollNo as properties then by using the Comparator interface we can … Read more