In this tutorial, it shows the use of java.lang.Comparable and java.util.Comparator to sort a Java object based on its property value.
Comparable and comparator both are an interface that can be used to sort the elements of the collection. Comparator interface belongs to java.util package while comparable belongs to java.lang package ...
We start with how sorting algorithms work. Although you don’t need to implement sorting algorithms yourself, it’s useful to know how they work internally. You can skip to the next section if you just ...