С здесь
Попробуйте что-то вроде этого:
val list = arrayListOf("a", "b", "c", "ą", "ć", "z", "ż")
val coll = Collator.getInstance(Locale("pl","PL"))
coll.strength = Collator.PRIMARY
Collections.sort(list, coll)
println(list)
Обновление:
Сделайте ваш объект реализуемым Comparable:
override fun compareTo(other: YourObject): Int {
val coll = Collator.getInstance(Locale("pl","PL"))
coll.strength = Collator.PRIMARY
val lastNameCompareValue = coll.compare(lastName?.toLowerCase(Locale("pl","PL")),other.lastName?.toLowerCase(Locale("pl","PL")))
if (lastNameCompareValue != 0) {
return lastNameCompareValue
}
val firstNameCompareValue = coll.compare(firstName?.toLowerCase(Locale("pl","PL")),other.firstName?.toLowerCase(Locale("pl","PL")))
return firstNameCompareValue
}
Попробуйте это.