Search Results

Search found 1 results on 1 pages for 'tarka'.

Page 1/1 | 1 

  • How to re-order a List<String>

    - by tarka
    I have created the following method: public List<String> listAll() { List worldCountriesByLocal = new ArrayList(); for (Locale locale : Locale.getAvailableLocales()) { final String isoCountry = locale.getDisplayCountry(); if (isoCountry.length() > 0) { worldCountriesByLocal.add(isoCountry); Collections.sort(worldCountriesByLocal); } } return worldCountriesByLocal; } Its pretty simple and it returns a list of world countries in the users locale. I then sort it to get it alphabetic. This all works perfectly (except I seem to occasionally get duplicates of countries!). Anyway, what I need is to place the US, and UK at the top of the list regardless. The problem I have is that I can't isolate the index or the string that will be returned for the US and UK because that is specific to the locale! Any ideas would be really appreciated.

    Read the article

1