In case you need the pair country code - name. This might be helpful:
source
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
public class CountryList {
public static List get() {
// A collection to store our country object
List countries = new ArrayList();
// Get ISO countries, create Country object and
// store in the collection.
String[] isoCountries = Locale.getISOCountries();
for (String country : isoCountries) {
Locale locale = new Locale("en", country);
String iso = locale.getISO3Country();
String code = locale.getCountry();
String name = locale.getDisplayCountry();
if (!"".equals(iso) && !"".equals(code) && !"".equals(name)) {
countries.add(new Country(iso, code, name));
}
}
// Sort the country by their name and then display the content
// of countries collection object.
Collections.sort(countries, new CountryComparator());
return countries;
}
/**
* Country pojo class.
*/
public static class Country {
private String iso;
private String code;
private String name;
Country(String iso, String code, String name) {
this.iso = iso;
this.code = code;
this.name = name;
}
public String toString() {
return iso + " - " + code + " - " + name.toUpperCase();
}
}
/**
* CountryComparator class.
*/
private static class CountryComparator implements Comparator {
private Comparator