First compare the second comparator, and then the first comparator. I believe this should do the trick. You can create a class for this.
class FullName { public String firstName; public String secondName; }
Let's say you create a new name called BobBobbins , assign values, and then just compare the second name first, and then the first name. You may have a static function to compare:
public static bool compareTo ( FullName name1, FullName name2 ) {
If you are using a static comparator, you might need to do this: FullName.compareTo( BobBobbins, CharlieChaplin );
Games brainiac
source share