Sort Java Objects Using Comparable And Comparator

There are two interfaces that can be used to sort objects in a list or array in java. They are java.lang.Comparable and java.util.Comparator. We all know java.util.Arrays and java.util.Collections has sort() method to sort an array or a list. But if you want to make the sorting successful, you should let the object in the array or list implement java.lang.Comparable …

Sort Java Objects Using Comparable And Comparator Read More »