I need to sort list of strings in the alphabetical order:
List<String> list = new ArrayList();
list.add("development");
list.add("Development");
list.add("aa");
list.add("AA");
list.add("Aa");
A common way to do it is to use comparator:
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
The problem of the CaseInsensitiveComparator that “AA” is equals to “aa”. Strings appear in the result according to the order of adding for the same values, and it is not correct:
"aa","AA","Aa","development","Development"