I have this list:
List<Country> countryList = new ArrayList<Country>();
And I want to sort the countries by their name, by using the method getCountry()
.
How can achieve this?
UPDATE:
public class Country implements Comparable
@Override
public int compareTo(Object another) {
// TODO Auto-generated method stub
return 0;
}
Can you tell how to compare them to get it sorted by Strings?
Argentina,
Austria,
Brazil, etc.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…