Sort Objects in a ArrayList using Java Comparable Interface

In my previous tut you would have learnt how to sort objects in a ArrayList using java comparator. It is almost the same as the previous instead of a seperate class for the implementing the Comparator we can implement it in the same Employee Class and we have to override compareTo method instead of compare method. So let see how to sort objects based on the Comparable interface.

[Read more…]