The following code works but it does take into account upper or lower case, and the result is a non alphabetically ordered list:
List<Pair<IContributionItem, String>> itemsList = new ArrayList<>();
Comparator<Pair<IContributionItem, String>> filePathComparator = Comparator.comparing(Pair<IContributionItem, String>::getPathToFile);
itemsList = itemsList.stream().sorted(filePathComparator).collect(Collectors.toList());
Then I came across String.CASE_INSENSITIVE_ORDER so I tried to add it to it:
Comparator<Pair<IContributionItem, String>> filePathComparator = Comparator.comparing(Pair<IContributionItem, String.CASE_INSENSITIVE_ORDER>::getPathToFile);
itemsList = itemsList.stream().sorted(filePathComparator).collect(Collectors.toList());
But it gives an error:
String.CASE_INSENSITIVE_ORDER cannot be resolved to a type.
What would be solution or workaround to accommodate the code?