I have one realm list and i want to sort the list alphabetically.
Collections.sort(contacts, new java.util.Comparator<Contacts>() {
@Override
public int compare(Contacts l1, Contacts l2) {
String s1 = l1.getName();
String s2 = l2.getName();
return s1.compareToIgnoreCase(s2);
}
});
But this logic not woking i am posting crash report below, please kindly go through it.
java.lang.UnsupportedOperationException: Replacing and element is not supported.
at io.realm.RealmResults$RealmResultsListIterator.set(RealmResults.java:826
at io.realm.RealmResults$RealmResultsListIterator.set(RealmResults.java:757)at java.util.Collections.sort(Collections.java:1909)
Please kindly go through my post and suggest me some solution.