How to use CompareToBuilder class?
This example show how we can use the
CompareToBuilder class for automatically create an implementation of
compareTo(Object o) method. Please remember when you implementing this method you will also need to implement the
equals(Object o) method consistently. This will make sure the behavior of your class consistent in relation to collections sorting process.