Advertisement
Guest User

Untitled

a guest
Sep 3rd, 2015
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. private List<String> countriesList = new ArrayList<String>();
  2.  
  3. public List<String> getCountriesList() {
  4.  
  5. String[] locales = Locale.getISOCountries();
  6.  
  7. for (String countryCode : locales) {
  8.  
  9. Locale obj = new Locale("", countryCode);
  10. countriesList.add(obj.getDisplayCountry(Locale.FRENCH));
  11.  
  12. }
  13. return countriesList;
  14. }
  15.  
  16. Collections.sort(countriesList, new Comparator<String>() {
  17. @Override
  18. public int compare(String str1, String Str2)
  19. {
  20. return str1.compareTo(str2);
  21. }
  22. });
  23.  
  24. List<String> countriesList = new ArrayList<String>();
  25.  
  26.  
  27.  
  28. String[] locales = Locale.getISOCountries();
  29.  
  30. for (String countryCode : locales) {
  31.  
  32. Locale obj = new Locale("", countryCode);
  33. countriesList.add(obj.getDisplayCountry(Locale.FRENCH));
  34. Collections.sort(countriesList);
  35. }
  36. for(String s:countriesList)
  37. {
  38. System.out.println(s);
  39. }
  40.  
  41. private List<String> countriesList = new ArrayList<String>();
  42.  
  43. public List<String> getCountriesList() {
  44.  
  45. String[] locales = Locale.getISOCountries();
  46.  
  47. for (String countryCode : locales) {
  48.  
  49. Locale obj = new Locale("", countryCode);
  50. countriesList.add(obj.getDisplayCountry(Locale.FRENCH));
  51.  
  52. }
  53. return Collections.sort(countriesList);
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement