The Java Sorting Conundrum: Comparable vs Comparator Interfaces
In this article I demonstrate how to implement the Comparable and Comparator interfaces in Java. Both of these interfaces are used to control the order in which objects in Collections and Arrays are sorted. I additionally discuss when you might want to use one over the other depending on use cases.