0

i have array list of country objects (name property is in arabic) I'm retrieving from a webservice, how can i sort this list based on the name property, can you please help me regards,

eshteghel company
  • 471
  • 1
  • 7
  • 22

1 Answers1

0

Sort List alphabetically:

java.util.Collections.sort(listOfCountryNames);

or sort ArrayList:

Collections.sort(list, new Comparator<String>() {
    @Override
    public int compare(String s1, String s2) {
        return s1.compareToIgnoreCase(s2);
    }
});
Aman Grover
  • 1,621
  • 1
  • 21
  • 41