Mar 29, 2018 While sorting elements in collection classes, these two interfaces Comparable and Comparator in Java come into picture. Both of these interfaces are used to sort collection elements. An obvious question which comes to mind is why two different interfaces? In this post we'll see the difference between Comparable and Comparator interfaces in Java and why both of them are required.