I have a requirement to sort the results of book retrieved from the database. The resultset contain 5 different columns like A B C D E. I implemented custom comparator to sort the values of column A as below
Sorting is happening perfectly. My question is if i need to provide user a option to sort other four columns, should i write 4 different classes implementing Comparator.
Also, as compareTo method is used here, do i need to override toString() , equals and hashCode method in my Book Class.
Please excuse me if it is very basic question. Kindly let me know your suggestions.
author and iconoclast