I want to sort an Array of Strings with this Method:
private String[] sortAscending(String[] arrayToSort) {
List<String> sortedList = Arrays.asList(arrayToSort);
Collections.sort(sortedList);
return (String[]) sortedList.toArray();
}
This will sort this Array
["Jens", "abCd", "test", "abC", "Peter"]
to this:
["Jens", "Peter", "abC", "abCd", "test"]
but it should be
["abC", "abCd", "Jens", "Peter", "test"]`
What am I doing wrong?