I have a sample class, say Country:
class Country {
public String name;
public int population;
public Flag flag;
...
}
I have this Flag class defined somewhere else
class Flag {
String id;
int pixel;
...
}
Now I create a separate comparator DefaultFlagRankingComparator() that can sort Flag by id. How can I sort a list of Country by Flag id, using this DefaultFlagRankingComparator()?