When sorting items based on a single attribute in a collection, the Comparator interface works extremely well.
However, this approach alone fails when there is a need to dynamically sort data on more than one field.
An article in the August 2004 edition of the Java Developers Journal explores how dynamic sorting can be accomplished through the use of the Comparator interface along with the Reflection API.
There will be a comparison of simple vs. dynamic sorting with the same set of employee data objects.
|