Is it possible to use the same Comparator class to compare any attribute of type String?
I have a person object with attributes:
String: firstName, lastName, address1, city, state, zip
Id like to be able to sort by any one attribute (firstname, lastname, and city for example).
Do i create a comparator class for each? FirstNameComparator, LastNameComparator, CityComparator, etc...
Or is it possible to create a comparator that accepts string? Is that what generics does?