JAVA
Sorting in Java (Comparator)
In my previous post, we saw Comparable and it’s implementation. Java provides another way to compare objects. Instead of implementing the comparable interface, we can implement the Comparator interface. The main difference between these two interfaces is that the comparable interface defines one method compareTo(), which takes one parameter. The Comparator interface defines Read more…