Please look at my method where I try to implement Collator to sort Objects with a "title" field. Method:
public List<SchoolSubject> findAllByOrderByTitle() {
List<SchoolSubject> schoolSubjects = subjectRepository.findAllByOrderByTitle();
Collator uaCollator = Collator.getInstance(new Locale("ua", "UA"));
uaCollator.setStrength(Collator.SECONDARY);
schoolSubjects.stream().sorted((s1, s2)->uaCollator.compare(s1.getTitle(), s2.getTitle()));
return schoolSubjects;
}
It sorts, but not correctly. Letter "i" is put at the very beginning. Whats wrong with it?