You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I want to be able to sort RealmResult or RealmList in a custom way. For example it is impossible to sort in Realm for Android by Location. I know there is a specific issue tracking this, but thinking more generally - there will always be another type or way of sorting you haven't gotten around to implementing.
Hi @snowpong . Thanks for the suggestion. As @Zhuinden points out this is already being tracked by especially #2313. The biggest problem with a custom sorting Comparator is that the sorting is done in C++ while the Comparator is java code. Calling back into Java to do sorting would probably be extremely expensive. That said we haven't really measured it yet, so it might be acceptable for small results.
In any case, i'll close this as an duplicate and let the discussion continue in #2313
Goal
I want to be able to sort RealmResult or RealmList in a custom way. For example it is impossible to sort in Realm for Android by Location. I know there is a specific issue tracking this, but thinking more generally - there will always be another type or way of sorting you haven't gotten around to implementing.
Expected Results
I can implement my own https://developer.android.com/reference/java/util/Comparator.html or similar, and use it directly in a Realm query.
Actual Results
I have to copy the result to a local list and run my custom sort there, loosing the benefits of change listeners etc.
The text was updated successfully, but these errors were encountered: